home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Choice 4
/
Choice CD-ROM 4 - Disc 1.iso
/
taiken
/
win95
/
ê¡‚Ì‹ó
/
toplevel.org
< prev
next >
Wrap
Text File
|
1995-08-24
|
142KB
|
5,098 lines
#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <commdlg.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <time.h>
#include <mbstring.h>
#include "emarn.h"
#include "musashi.h"
#include "resource.h"
#include "always.h"
#include "pai.h"
#include "sethai.h"
#include "form.h"
#include "mygraph.h"
#include "menu.h"
#include "key.h"
#include "cond.h"
#include "para.h"
#include "evsub.h"
#include "ddgraph.h"
/* ======================windows版変化部分======================= */
E_FLAG eFlag;
BOOLEAN emrn=FALSE;
static int eErr;
static int tonke;
static int dl1,ton_id;
static int na = 0;
static enum Cond condition = COND_THUMO;
static TEHAI *tehai;
static enum Cond workID;
static int hai, wh; /* haitype */
static int prwcnt, dl2;
static int dl3, work, workp;
static int dl4;
static enum Cond cnd = COND_STEHAI;
int Hp;
int Hcnd,Hin;
int Co;
int CPK_x,CPK_y;
enum Cond RTK[4]; /* コマンド */
enum Cond CPKR[5];
int RTK_point;
int RTK_cnt;
int CPK_point;
int CPK_cnt;
int tkan_flag;
BOOLEAN reach_flag;
BOOLEAN thumo_flag;
BOOLEAN chee_flag;
BOOLEAN pon_flag;
BOOLEAN kan_flag;
BOOLEAN ron_flag;
int chee_in; /* チーの選択用 */
int chee_cnt;
int chee_work[3];
extern struct HAI_DISP_POS TP[4];
int ind_group[7][4];
extern int gind_cnt[5];
static int mastNo;
extern int ind_cnt;
extern int ind_set[14];
extern int gind_no[5];
extern int gind_cnt[5];
extern int gind_top[5];
static int reaSteFlag;
extern int USR_stehai;
extern int nakiMarks[4];
extern int far base_x[4];
extern int far base_y[4];
extern int far hai_w[4];
extern int far hai_h[4];
extern HBITMAP far usrButton[6];
extern HBITMAP far opening;
static int nakiMatrix[6];/* 鳴きポップアップ用の鳴き種別確定変数 */
static int nakiChecker[6];/* 鳴きポップアップのチェック用 */
extern int tehaiMouse[20];/* 手牌のマーカーを8ドット浮かせるための手牌pool変数 */
extern int allTehaiNo;/* 全手配数の記録用変数 */
int seFlag;
/*int shaiNo[4][20];
int shaiState[4][20];
int shai[4];*/
char scoreName[4][13];
char scoreSt1[4][32];
char scoreSt2[4][32];
YAKU_MRX yakuMatrix;
static char dispMessage[16];
static int reachMatrix[4];
static int selectChar;
/* ダイアログ */
long FAR PASCAL _export WndProc (HWND, UINT, UINT, LONG) ;
BOOL FAR PASCAL _export InitDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export MastDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export CharDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export UtilDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export EnviDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export DekuDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export Ha99DlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export DispDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export ScorDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export EScrDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export YakuDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export RyukDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export MesdDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export MemiDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export TotaDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export ProfDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export KatiDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export ChgpDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export ChgnDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export FddsDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export ChrEDlgProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export AbouDlgProc(HWND, UINT, UINT, LONG);
static FARPROC lpfnWndpDlgProc;
static FARPROC lpfnInitDlgProc;
static FARPROC lpfnMastDlgProc;
static FARPROC lpfnCharDlgProc;
static FARPROC lpfnUtilDlgProc;
static FARPROC lpfnEnviDlgProc;
static FARPROC lpfnDekuDlgProc;
static FARPROC lpfnHa99DlgProc;
static FARPROC lpfnDispDlgProc;
static FARPROC lpfnScorDlgProc;
static FARPROC lpfnEScrDlgProc;
static FARPROC lpfnYakuDlgProc;
static FARPROC lpfnRyukDlgProc;
static FARPROC lpfnMesdDlgProc;
static FARPROC lpfnMemiDlgProc;
static FARPROC lpfnTotaDlgProc;
static FARPROC lpfnProfDlgProc;
static FARPROC lpfnKatiDlgProc;
static FARPROC lpfnChgpDlgProc;
static FARPROC lpfnChgnDlgProc;
static FARPROC lpfnFddsDlgProc;
static FARPROC lpfnChrEDlgProc;
static FARPROC lpfnAbouDlgProc;
static HINSTANCE hDlgInstance;
/* AP名 */
char szAppName [] = "musashi" ;
char iconName [] = "IDI_ICON1" ;
char cursorName[] = "IDC_CURSOR2";
char *kyokuMessage;
char ba_msg[2][4][11] = {
{"東 一 局","東 二 局","東 三 局","東 ラ ス"},
{"南 一 局","南 二 局","ラ ス 前"," オーラス "}
};
/* 重要なもん */
HINSTANCE far hInst;
HWND far hWnd;
HMENU far hMenu;
HMENU far hSubMenu;
HMENU far hPopMenu;
HDC far hdc;
extern HCURSOR far winCursor[4];
static int xsClip,xeClip,ysClip,yeClip;
static BOOLEAN dir99,dirThumo;
static int jumpFlag;
int far RTK_Cont[4];
int far CPKR_Cont[5];
extern int pick_man_list[17];
static int reaStick;
static int meijin;
static int doraFlag;
extern int systemError;
/* 旧関数定義 */
extern enum Cond Com_thumo(int id);
extern BOOLEAN canagari(TEHAI *tehai,int hai);
extern int getcalscr(TEHAI *, int, BOOLEAN);
extern int siko(int);
extern int haicount(HAIS *,int);
extern void indicate_hai(int);
extern void open_window_RTK(TEHAI *);
extern void learn_naki(int, int);
extern BOOLEAN canreach2(TEHAI *,int);
extern int checkhai(TEHAI *,int);
extern int siko2(int);
extern void unindicate_hai(int);
extern int Com_stehai(int);
extern enum Cond Com_naki(int, int, int);
extern void init_top_eval(int);
extern int ponok(int, int);
extern int kanok(int, int);
extern int cheeok(int, int);
extern void open_window_CPK(int, TEHAI *);
extern void end_flush_stehai(int);
extern int canckan(TEHAI *,int);
extern void dispose_gind(void);
extern void display_gind(int id);
extern void left_gind(int x);
extern void right_gind(int x);
extern void flush_stehai(int id,int on_off);
/* 新関数定義 */
extern int MenNamePull(char **menName);
extern void CloseHai(void);
extern void display_dora(void);
extern void display_sai(void);
extern void display_bahyoji(void);
extern void display_stehai(void);
extern void display_udora(void);
extern void disp_naki(void);
extern void display_eachscr(int num,int sc,int delta,char *name);
extern HBITMAP StretchBitmap(HBITMAP hBitmap1);
extern void OpenPut(HDC hdc);
extern void OpenPut2(HDC hdc);
extern void OpenDelete(void/*HDC hdc*/);
extern void OpenLoad(void);
/*extern void Dfase_put_prof(HDC hDc,int n,int me); */
/*extern void Dfase_put_kachi(HDC hDc,int n,int me,int No); */
extern void RecoverPalette(HDC hDc);
extern void HelpProc(void);
extern DWORD SoundSetUp(void);
extern DWORD MusicPlay(HWND hn,int musicNo);
extern DWORD WavePlay(int waveNo);
extern DWORD MusicClose(void);
extern DWORD WaveClose(void);
extern DWORD MusicReplay(HWND hn);
extern void WaveFunc(int cnd,int flag);
extern void PASCAL NEAR OpenMciFile(HWND hwndDlg,LPSTR lszFile);
void MenuControl(int group,UINT flag);
void ClearGomi(int n);
#define get_gind(x) (gind_no[x]-gind_top[x])
/* ========================既存部分========================== */
extern int Ckanflag;
extern BOOLEAN Haiteflag;
man_type men[];
int Display_Option;
extern int bgm_flag,eff_flag;
int CurHai;
MEMBER Member[4];
haitype Phai[34] = INITSET;
int Ba_mark;
BOOLEAN Kanflag = FALSE;
BOOLEAN Firstflag = TRUE;
BOOLEAN Speed = 0;
int Jun = 0;
int Teach_mode;
int Kansen_mode;
int Sinan_mode;
int Game_mode;
jmp_buf Jenv;
BOOLEAN Debug_flag = FALSE;
BOOLEAN TestFlag = FALSE;
BOOLEAN Open_mode;
FILE *TestF;
int DebugMode = 0;
static int Siba;
static int Stick;
static haitype Oldhai = nullhai;
int NewID = 0;
int OldID = 0;
int start_id = 0;
int ExTopMenu = 0;
static int gSpeed;
static int Prw[] = {0,0,0,0,3,2,1,4,0};
#define relocate(ID1,ID2) (((ID1) + (3-(ID2))) % 4)
enum {
ryukyoku,
kan4,
kyushu,
ron3,
kaze4,
reach4
} Endflag;
extern void add_display_dora(int, int);
extern int makedora(void);
extern void put_alltehai(int);
extern void count_alltehai(int);
extern void readythumo(void);
extern void display_init(int,int);
extern void display_hyochar(int, int);
extern void display_ba(int, int);
extern void display_saikoro(int, int, int);
extern void put_thumo(int, int);
extern BOOLEAN Dir_end99(int);
extern enum Cond Dir_thumo(int);
extern void put_reach_stick(int);
extern int Dir_stehai(int);
extern BOOLEAN tempai(TEHAI *);
extern BOOLEAN furiten(TEHAI *);
extern void set_ron_info(TEHAI *);
extern void set_safu_info(int, int);
extern void learn_safu(int);
extern void anime_stehai(int, int, int, BOOLEAN);
extern BOOLEAN Dir_ron(int, int);
extern enum Cond Dir_naki(int, int, int);
extern void anime_akan(int,int);
extern void anime_pkan(int,int);
extern BOOLEAN Dir_chankan(int, int);
extern void anime_mkan(int,int,int);
extern void anime_pon(int,int,int);
extern void anime_chee(int,int);
extern void display_eachscore(int, int, int, char *);
extern int down_eachscore(int);
extern void dispose_eachscore(int);
extern void display_lastscore(int, int, char *);
extern void display_message(char *);
extern void display_kyoku(int, int);
extern void put_haipai(int);
extern void dispose_message(void);
extern void option(void);
extern void learn_yaku(int);
extern void del_reach_stick(int);
extern void anime_ron(int, int, int);
extern void display_uradora(int);
extern int makedummydora(void);
extern int calscr(TEHAI *, int, BOOLEAN);
extern void learn_agari(void);
extern void learn_anpai(void);
extern BOOLEAN nagasi(TEHAI *);
extern void display_nagasi(int);
extern void display_ryukyoku(void);
extern void Ginit(void);
extern int load_all_man(int);
extern int save_all_man(void);
extern int get_topmenu(int);
extern void display_member(void);
extern void put_message(char *);
extern int pick_sinan(int);
extern void input_kan(char *);
extern int change_myname(char *);
extern void init_man(int);
extern void display_all_man2(void);
extern int pick_myname(void);
extern void display_message_xy(char *[], int, int, int, int);
extern int init_member_data(int);
extern int pick_member(int);
extern int trans_member(int);
extern void Gclose(void);
extern char *tozennum(int);
extern int *pick_other(int,int);
extern void open_end_menu(menu *);
extern void set_all_palette(int);
/*static int utility(void); */
char END_MSG[] = "半荘 終了";
/*=====================================================================
要約:メイン関数
書式:int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
概要:windowsアプリケーションのメイン関数
=======================================================================*/
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
HMENU hmenu;
ATOM regclass;
if (!hPrevInstance) {
wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_BYTEALIGNWINDOW;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon(hInstance, iconName) ;
wndclass.hCursor = /*LoadCursor (NULL, IDC_ARROW)*/ NULL;
wndclass.hbrBackground = CreateSolidBrush (0x008000L) ;
wndclass.lpszMenuName = szAppName ;
wndclass.lpszClassName = szAppName ;
regclass=RegisterClass (&wndclass) ;
}
hmenu = LoadMenu(hInstance,szAppName);
hMenu=hmenu;
hInst = hInstance;
hwnd = CreateWindow (szAppName, "麻雀 武蔵 for WIN Ver.1.0",
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX,
CW_USEDEFAULT, CW_USEDEFAULT,
540, 400+GetSystemMetrics(SM_CYMENU)+GetSystemMetrics(SM_CYCAPTION),
NULL, hmenu, hInstance, NULL) ;
hWnd = hwnd;
/* OpenMciFile(hwnd,lpszCmdLine); */
ShowWindow (hwnd, nCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0)) {
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
/*=====================================================================
要約:ナキ用ポップアップメニュー作成関数
書式:static void CreatNakiMenu();
概要:切り離した形状のポップアップメニューを表示する
BMP張り付けポップアップ
=======================================================================*/
static void CreateNakiMenu(long lp)
{
int i;
static int j;
int flag=0;
POINT ptCurrent;
HBITMAP poolBitmap[6];
HDC hdcOrg,hdcMem1,hdcMem2;
BITMAP dBitmap1,dBitmap2;
j=0;
hdcOrg=GetDC(hWnd);
for (i=0 ; i<6 ; i++)
if (nakiMatrix[i]==1)
flag++;
if (flag==0)
return;
ptCurrent = MAKEPOINT(lp);
hPopMenu = CreatePopupMenu();
for (i=0 ; i<6 ; i++) {
if (nakiMatrix[i]==1) {
GetObject(usrButton[i], sizeof(BITMAP), (LPSTR)&dBitmap1);
dBitmap2=dBitmap1;
hdcMem1 = CreateCompatibleDC(hdcOrg);
hdcMem2 = CreateCompatibleDC(hdcOrg);
poolBitmap[j]=CreateBitmapIndirect(&dBitmap2);
SelectObject(hdcMem1, usrButton[i]);
SelectObject(hdcMem2, poolBitmap[j]);
BitBlt(hdcMem2,0,0,dBitmap1.bmWidth, dBitmap1.bmHeight,
hdcMem1,0,0,SRCCOPY);
if (nakiChecker[i]==0x01)
AppendMenu(hPopMenu, MF_CHECKED|MF_BITMAP|MF_ENABLED,IDM_PON+i,(LPSTR)(LONG)poolBitmap[j]);
else
AppendMenu(hPopMenu, MF_BITMAP|MF_ENABLED,IDM_PON+i,(LPSTR)(LONG)poolBitmap[j]);
DeleteDC(hdcMem1);
DeleteDC(hdcMem2);
j++;
}
}
ClientToScreen(hWnd, &ptCurrent);
TrackPopupMenu(hPopMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON, ptCurrent.x, ptCurrent.y, 0, hWnd, NULL);
ReleaseDC(hWnd,hdcOrg);
for (i=0 ; i<flag ; i++)
DeleteObject(poolBitmap[i]);
DestroyMenu(hPopMenu);
}
void KillPopMenu(void)
{
;
}
/************************************************/
/* */
/* clrippatu */
/* */
/************************************************/
static void clrippatu(void)
{
int i;
Firstflag = FALSE;
for ( i = 0; i < 4; i++ ) {
Member[i].tehai.ippatu = FALSE;
}
}
/************************************************/
/* */
/* 4 reach */
/* */
/************************************************/
static int reach_num(void)
{
int i,n;
n = 0;
for ( i = 0; i < 4; i++ ) {
if ( Member[i].tehai.reach ) {
++n;
}
}
return n;
}
/************************************************/
/* */
/* 4 kan check */
/* */
/************************************************/
static int Kancnt; /* have to set zero */
static BOOLEAN is4kan(int id)
{
static int kanwork[5];
int i;
kanwork[Kancnt++] = id;
add_display_dora(makedora(),Kancnt);
if ( Kancnt == 4 ) {
for ( i = 0; i < 2; i++ ) {
if ( kanwork[i] != kanwork[i+1] ) {
return (TRUE);
}
}
return (FALSE);
} else if ( Kancnt == 5 ) {
return (TRUE);
} else {
return (FALSE);
}
}
/*
** オープンモードの切り替え
*/
int open_tehai(void)
{
int i;
Open_mode = !Open_mode;
for ( i = 0; i < 3; i++ ) {
Member[i].tehai.open = Open_mode;
put_alltehai(i);
}
return (Open_mode);
}
/************************************************/
/* */
/* init */
/* */
/************************************************/
void init_top_top(void)
{
int i;
Teach_mode = FALSE;
Open_mode = FALSE;
if ( Kansen_mode ) Teach_mode = TRUE;
Siba = 0;
Stick = 0;
Ba_mark = TON;
for ( i = 0; i < 4; i++ ) {
Member[i].score = 2700;
}
}
void init_toplevel(int id)
{
int i;
Kanflag = FALSE;
Ckanflag = FALSE;
Firstflag = TRUE;
Kancnt = 0;
memset(Phai,0,sizeof(Phai[0])*KHAI);
readythumo();
for ( i = 0; i < 4; i++ ) {
#ifdef DEBUG
if ( TestFlag && i == 3 ) {
testpai(&Member[i].tehai);
} else {
haipai(&Member[i].tehai);
}
#else
haipai(&Member[i].tehai);
#endif
Member[i].stg = 0;
Member[i].tehai.kaze = ((4 - id + i) % 4) + TON;
Member[i].id = i+1;
Member[i].tehai.open = Open_mode;
Member[i].learn_yaku = 0;
if ( i == 3 ) {
Member[i].tehai.open = TRUE;
Member[i].id = 0;
}
}
OldID = id;
NewID = id;
/* ここが表示部分 */
display_init(makedora(),doraFlag);
display_hyochar(Siba,reaStick);
display_ba(start_id,Ba_mark);
display_saikoro(id,rand()%6,rand()%6);
doraFlag=0;
}
BOOLEAN end99(TEHAI *tehai)
{
int i;
int c = 0;
for ( i = 0; i < KHAI; i++ ) {
if ( isyao(i) && tehai->tset[i] ) c++;
}
if ( c >= 9 ) return (TRUE);
return (FALSE);
}
BOOLEAN is4kaze(void)
{
int i, h;
if ( !Firstflag ) return (FALSE);
for ( i = 0; i < 4; i++ ) {
if ( Member[i].tehai.stecnt != 1 ) return (FALSE);
}
h = Member[0].tehai.stehai[0].hai;
if ( h == Ba_mark ) return (FALSE);
for ( i = 1; i < 4; i++ ) {
if ( (int)Member[i].tehai.stehai[0].hai != h ) return (FALSE);
}
return (TRUE);
}
/************************************************/
/* */
/* 一局 */
/* */
/************************************************/
#define opt_num(x) (x % 10 != 0 ? (x/10+1)*10 : x)
/*
** 点数の増減をセットする
*/
static void set_score(int sc)
{
int i;
int sc1, sc2, sc3;
if ( NewID == OldID ) { /* ツモ */
if ( Member[NewID].tehai.kaze == TON ) {
sc1 = -opt_num(sc/3)-Siba*10;
sc3 = opt_num(sc/3)*3+Siba*30+Stick*100;
} else {
sc1 = -opt_num(sc/4)-Siba*10;
sc2 = -opt_num(sc/2)-Siba*10;
sc3 = opt_num(sc/4)*2+opt_num(sc/2)+Siba*30+Stick*100;
}
for ( i = 0; i < 4; i++ ) {
if ( i == NewID ) { /* 上がった人 */
Member[i].delta = sc3;
} else {
if ( Member[i].tehai.kaze == TON ) {
Member[i].delta = sc2;
} else {
Member[i].delta = sc1;
}
}
}
} else {
for ( i = 0; i < 4; i++ ) {
Member[i].delta = 0;
}
Member[NewID].delta = sc+Siba*30+Stick*100;
Member[OldID].delta = -sc-Siba*30;
}
}
/*
** 流局の点数の計算
*/
static void set_ryukyoku_score(void)
{
int i;
int c = 0;
int f[4];
int sc1, sc2;
for ( i = 0; i < 4; i++ ) {
Member[i].delta = 0;
f[i] = tempai(&Member[i].tehai);
if ( f[i] ) {
c++;
Member[i].tehai.open = TRUE;
put_alltehai(i);
}
}
if ( (c != 0) && (c != 4) ) {
sc1 = 300/c;
sc2 = -300/(4-c);
for ( i = 0; i < 4; i++ ) {
if ( f[i] ) {
Member[i].delta = sc1;
} else {
Member[i].delta = sc2;
}
}
}
}
/*
** 点数の表示と加算
*/
static void display_score(void)
{
/* int i;
int flag[4];
int all = FALSE;
for ( i = 0; i < 4; i++ ) {
flag[i] = FALSE;
if ( Member[i].delta != 0 ) {
flag[i] = TRUE;
all = TRUE;
display_eachscore(i,Member[i].score,Member[i].delta,men[Member[i].men].name);
Member[i].score += Member[i].delta;
}
}
Wait(all?1000:1500);
while ( all ) {
all = FALSE;
for ( i = 0; i < 4; i++ ) {
if ( flag[i] ) {
flag[i] = (down_eachscore(i) != 0 ? TRUE : FALSE);
}
all |= flag[i];
}
}
Wait(1000);
for ( i = 0; i < 4; i++ ) {
if ( Member[i].delta == 0 ) {
display_eachscore(i,Member[i].score,0,men[Member[i].men].name);
}
}
Wait(2500);
for ( i = 0; i < 4; i++ ) {
dispose_eachscore(i);
}
*/
}
void display_each_score(void)
{
int i;
for ( i = 0; i < 4; i++ ) {
display_eachscore(i,Member[i].score,0,men[Member[i].men].name);
}
/* while ( get_stick() == 0 )*/
;
for ( i = 0; i < 4; i++ ) {
dispose_eachscore(i);
}
}
static int last_sc[4];
static void display_all_lastscore(void)
{
int i, j, a;
int maxi = 0;
int max_sc = MININT;
for ( i = 0; i < 4; i++ ) {
j = (start_id+i) % 4;
a = Member[j].score;
if ( max_sc < a ) {
max_sc = a;
maxi = j;
}
a /= 10;
if ( a % 10 <= 5 ) {
a /= 10;
} else {
a = a/10+1;
}
last_sc[j] = a-30;
}
a = 0;
for ( i = 0; i < 4; i++ ) {
if ( i != maxi ) a -= last_sc[i];
}
last_sc[maxi] = a;
/* for ( i = 0; i < 4; i++ ) {
display_lastscore(i,last_sc[i],men[Member[i].men].name);
} */
}
#if 0
static int Order_lisr[4];
static void get_junban(void)
{
int i, j, c, t, t2;
for ( i = 0; i < 4; i++ ) {
t = (start_id +i ) % 4;
c = 0;
for ( j = 0; j < 4; j++ ) {
t2 = (start_id + j) % 4;
if ( (last_sc[t2] > last_sc[t])
|| ((last_sc[t2] == last_sc[t]) && (j < i)) ) {
c++;
}
}
Order_list[t] = c;
}
}
#endif
static int get_topman(void)
{
int i, j, a;
int maxi = 0;
int max_sc = MININT;
for ( i = 0; i < 4; i++ ) {
j = (start_id+i) % 4;
a = Member[j].score;
if ( max_sc < a ) {
max_sc = a;
maxi = j;
}
}
return (Member[maxi].men);
}
void DestroyMenuCheck(void)
{
int i;
hSubMenu=GetSubMenu(hMenu,2);
for (i=IDM_PON ; i<IDM_TUM+1 ; i++)
CheckMenuItem(hSubMenu, i,MF_BYCOMMAND|MF_UNCHECKED);
}
void Display_reach_b(void)
{
int i;
for (i=0 ; i<4 ; i++) {
if (reachMatrix[i]==1)
put_reach_stick(i);
}
}
/*
** 一局
*/
/* 連荘:true その他:false */
/*
** 半局の処理
*/
/* =====WM_PAINT========================================================*/
static void hanchan(HWND hWnd,int wm,int tr,int pc)
{
static TEHAI *tehai_u;
static enum Cond a, b;
static enum Cond cnd_dl1;
static BOOLEAN r;
static BOOLEAN dl5;
static int c;
static int dla, dlb, dlc;
static int reach_mark;
extern int Ckanflag;
static enum Cond dl6;
int i;
START:
/* すっ飛ばす */
eFlag.act=AC_DEFAULT;
switch (jumpFlag)
{
case J_ASK_SUB_RTK:
goto ASK_SUB_RTK;
case J_ASK_SUB_CPKR1:
goto ASK_SUB_CPKR1;
case J_ASK_SUB_CPKR2:
goto ASK_SUB_CPKR2;
case J_USR_STEHAI:
goto USR_STEHAI;
case J_AS_RTK_KAN:
goto ASK_SUB_RTK_KANSEN;
case J_AS_CPKR1_KAN:
goto ASK_SUB_CPKR1_KANSEN;
case J_USTEHAI_KAN:
goto USR_STEHAI_KANSEN;
case J_AS_RTK_COM:
goto ASK_SUB_RTK_COMP;
case J_AS_CPKR1_COM:
goto ASK_SUB_CPKR1_COMP;
case J_USTEHAI_COM:
goto USR_STEHAI_COMP;
}
if (eFlag.tern == IC_KYOKUEND) {
tr = IC_HANST;
eFlag.tern = IC_HANST;
doraFlag=1;
}
/* 半荘内初期化 */
/* 半荘内状態では素通り */
/* 一局内状態では素通り */
if (wm==WM_PAINT&&tr==IC_PLAYERSEL) {
srand((unsigned int)time(NULL));
init_top_top();
reaStick=0;
tonke=0;
start_id = rand() % 4;
eFlag.tern=IC_HANST;
tr=IC_HANST;
memset(nakiChecker,0x00,12);
reach_mark=0;
}
/* 一局内初期化 */
/* 一局内状態では素通り */
if (tr==IC_HANST) {
condition=COND_THUMO;
na=0;
ton_id = (start_id+tonke) % 4;
init_toplevel(ton_id);
xsClip=base_x[SHITA];
ysClip=base_y[SHITA]-32;
xeClip=base_x[SHITA]+hai_w[SHITA]*14;
yeClip=base_y[SHITA]-32+hai_h[SHITA];
}
/* これはメッセージボックスでする */
/* 一局内状態では素通り */
if (tr==IC_HANST) {
kyokuMessage=ba_msg[Ba_mark-TON][tonke];
DialogBox(hDlgInstance, "KyokuDisp", hWnd, (DLGPROC)lpfnDispDlgProc);
reaSteFlag=0;
for (i=0 ; i<4 ; i++)
reachMatrix[i]=0;
}
/* 配牌部分 */
/* 一局内状態では素通り */
if (tr==IC_HANST) {
for ( dl1 = 0; dl1 < 4; dl1++ ) {
put_haipai(dl1); /* graphics */
}
for ( dl1 = 0; dl1 < 4; dl1++ ) {
Member[dl1].tehai.top = haisort(Member[dl1].tehai.top);
put_alltehai(dl1); /* graphics */
}
eFlag.tern=IC_KYOKU;
tr=IC_KYOKU;
}
/* delay(1000); */
/* dispose_message(); */
/* =========一局が終わるまで繰り返すらしい(^^;======== */
if (eFlag.tern==IC_KYOKU) {
/* ウエイト入れるならここ */
/* 問題はここ(^^; */
/* 一手の処理 */
tehai = &Member[NewID].tehai;
if ( tehai->stecnt != 0 ) {
Firstflag = FALSE;
}
switch ( condition ) {
case COND_THUMO:
if ( Haiteflag ) {
Endflag = ryukyoku;
condition = COND_END;
break;
}
wh = thumo();
CurHai = wh;
Member[NewID].work = wh;
haiadd(tehai,CurHai);
/* ツモ音入れるならここ */
put_thumo(NewID,wh); /* graphics */
/* ここは要はTRUE(九種九牌流し)かFALSE(流さない)
が返ってくるだけ。コンピュータは必ず流す */
if (Firstflag) {
if (end99(tehai)) {
if ( Kansen_mode || (NewID != USRNO) ) {
dir99=TRUE;
} else {
DialogBox(hDlgInstance, "Hai99", hWnd, (DLGPROC)lpfnHa99DlgProc);
}
}
if (dir99==TRUE) {
Endflag = kyushu;
condition = COND_END;
dir99 = FALSE;
break;
}
}
/* 入力部分のあるところらしい(^^; */
if ( Kansen_mode ) {
jumpFlag=J_AS_RTK_KAN;
eFlag.act=AC_DEVIDE;
return;
ASK_SUB_RTK_KANSEN:
jumpFlag=J_DEFAULT;
dirThumo = Com_thumo(NewID);
WaveFunc(dirThumo,1);
} else if ( NewID == USRNO ) {
/* ====================これをなんとかする=================== */
cnd = COND_STEHAI;
tehai_u = &Member[NewID].tehai;
if ( canagari(&Member[NewID].tehai,-1)
&& (getcalscr(&Member[NewID].tehai,Member[NewID].work,FALSE) != 0) ) {
thumo_flag = TRUE;
Member[NewID].tehai.furiten = TRUE;
} else {
thumo_flag = FALSE;
}
tkan_flag = canakan(tehai_u);
reach_flag = canreach(&Member[NewID].tehai);
Hcnd = COND_STEHAI;
Co = Member[NewID].tehai.count-1;
if ( !Member[NewID].tehai.reach ) {
a = (enum Cond)siko(NewID); /* 指示モード? */
} else {
a = (enum Cond)DO_STEHAI;
}
if ( Sinan_mode || Teach_mode || Kansen_mode ) {
if ( a == DO_ANKAN ) {
Hcnd = COND_TKAN;
for ( dl4 = 0; dl4 < tkan_flag; dl4++ ) {
if ( KanHai == Kanlist[dl4] ) {
Hin = dl4;
break;
}
}
}
if ( a == DO_REACH ) Hcnd = COND_REACH;
if ( thumo_flag ) Hcnd = COND_RON;
if ( thumo_flag || Member[NewID].tehai.reach ) {
Hp = Co;
} else {
Hp = haicount(Member[NewID].tehai.top,SteHai)-1;
}
} else { /* ノーマルモード */
Hp = Co;
}
if ( !Kansen_mode ) { /* 観戦モード */
/* indicate_hai(Hp);*/
if ( tkan_flag || reach_flag || thumo_flag ) {
/* ================ask_RTK================= */
open_window_RTK(&Member[NewID].tehai);
r = (Member[NewID].tehai.reach && !Member[NewID].tehai.ippatu);
eFlag.act=AC_MOUSE;
/* ================ask_sub_RTK================= */
/* ここがえらい問題 */
/* サブメニューのアクティブ化 */
Co = Member[NewID].tehai.count-1;
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
for (dlc=0 ; RTK[dlc]!=COND_STEHAI ; dlc++) {
hSubMenu=GetSubMenu(hMenu,2);
switch (RTK[dlc]) {
case COND_RON:
EnableMenuItem(hSubMenu, IDM_TUM, MF_ENABLED);
nakiMatrix[5]=1;
break;
case COND_REACH:
EnableMenuItem(hSubMenu, IDM_REA, MF_ENABLED);
nakiMatrix[3]=1;
break;
case COND_TKAN:
EnableMenuItem(hSubMenu, IDM_KAN, MF_ENABLED);
nakiMatrix[2]=1;
break;
}
}
/* すっ飛ばし布石 */
if (eFlag.act==AC_MOUSE) {
jumpFlag=J_ASK_SUB_RTK;
/* SetCursor(winCursor[1]); */
count_alltehai(NewID);
/* indicate_hai(Hp); */
return;
}
ASK_SUB_RTK:
/* 再度サブメニューをフリーズ */
jumpFlag=0;
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
MenuControl(2, MF_GRAYED);
DestroyMenuCheck();
cnd=RTK[RTK_point];
/* 離脱条件 :リターンが押されるまで
離脱時変化:cndにRTK配列の何が選択されたかを移す
以降、cnd の値で判定を行う */
/* ================ask_sub_RTK================= */
/* ウインドウ消去 deactive(USR_W); */
/* ================ask_RTK================= */
}
if ( cnd == COND_TKAN ) {
Member[NewID].work = Kanlist[get_gind(RTK_point)];
}
if ( !Sinan_mode && !Member[NewID].tehai.reach ) {
switch ( cnd ) { /* 実行されるものを求める */
case COND_TKAN:
b = DO_ANKAN;
break;
case COND_REACH:
b = DO_REACH;
break;
case COND_STEHAI:
b = DO_STEHAI;
break;
case COND_RON:
b = DO_RON;
break;
}
learn_naki(a,b);
if ( Member[NewID].tehai.stecnt < 4 ) {
learn_yaku(0);
} else {
learn_yaku(1);
}
}
} else {
cnd = Hcnd;
if ( cnd == COND_TKAN ) Member[NewID].work = KanHai;
}
if ( (cnd == COND_REACH) && !canreach2(tehai_u,checkhai(tehai_u,Hp)) ) {
cnd = COND_STEHAI;
}
USR_stehai = Hp;
dirThumo=cnd;
/* ====================これをなんとかする=================== */
} else {
jumpFlag=J_AS_RTK_COM;
eFlag.act=AC_DEVIDE;
return;
ASK_SUB_RTK_COMP:
jumpFlag=J_DEFAULT;
dirThumo = Com_thumo(NewID);
}
/* 入力結果の判定 */
switch (dirThumo) {
/* 捨牌したとき */
case COND_STEHAI:
Kanflag = FALSE;
tehai->ippatu = FALSE;
condition = COND_STEHAI;
/* if ( NewID == USRNO )
reach_mark=1;
*/
break;
/* リーチして捨牌したとき */
case COND_REACH:
set_reach(tehai);
put_reach_stick(NewID); /* graphics */
Stick++;
Member[NewID].score -= 100;
Kanflag = FALSE;
condition = COND_STEHAI;
if (NewID==3)
reaSteFlag++;
if ( NewID == USRNO )
reach_mark=1;
reachMatrix[NewID]=1;
WaveFunc(dirThumo,1);
break;
/* ツモったとき */
case COND_RON:
Oldhai = (haitype)wh;
condition = COND_RON;
if ( NewID == USRNO )
reach_mark=1;
WaveFunc(dirThumo,1);
break;
/* 槓したとき */
case COND_TKAN:
Kanflag = FALSE;
tehai->ippatu = FALSE;
condition = COND_TKAN;
if ( NewID == USRNO )
reach_mark=1;
WaveFunc(dirThumo,1);
break;
/* することがないとき */
default:
condition = COND_END;
}
break;
case COND_STEHAI:
/* ===============Dir_stehai============= */
if ( Kansen_mode ) {
jumpFlag=J_USTEHAI_KAN;
eFlag.act=AC_DEVIDE;
return;
USR_STEHAI_KANSEN:
jumpFlag=J_DEFAULT;
dl2=Com_stehai(NewID);
} else if ( NewID == USRNO ) {
/* =====================Usr_stehai======================= */
eFlag.act=AC_MOUSE;
Co = Member[NewID].tehai.count-1;
if ( USR_stehai >= 0 ) {
Hp = USR_stehai;
USR_stehai=-1;
} else { /* 鳴きからきた場合 */
if ( Sinan_mode || Teach_mode || Kansen_mode ) { /* 指示モード */
Hp = haicount(Member[NewID].tehai.top,siko2(NewID))-1;
} else {
Hp = Co;
}
}
if (eFlag.act==AC_MOUSE&&reach_mark==0) {
jumpFlag=J_USR_STEHAI;
/* SetCursor(winCursor[1]); */
MenuControl(2, MF_GRAYED);
count_alltehai(NewID);
indicate_hai(Hp);
return;
}
USR_STEHAI:
if (reach_mark!=0)
reach_mark=0;
/* SetCursor(winCursor[0]); */
jumpFlag=0;
unindicate_hai(Hp);
DestroyMenuCheck();
dl2=Hp+1;
/* =====================Usr_stehai======================= */
} else {
jumpFlag=J_USTEHAI_COM;
eFlag.act=AC_DEVIDE;
return;
USR_STEHAI_COMP:
jumpFlag=J_DEFAULT;
dl2=Com_stehai(NewID);
}
/* ===============Dir_stehai============= */
hai = haidel(tehai,dl2);
if ( (!tehai->reach || tehai->ippatu) && tempai(tehai) ) {
tehai->furiten = furiten(tehai);
}
set_ron_info(tehai);
set_safu_info(NewID,hai);
if ( (NewID == 3) && !tehai->reach && !Sinan_mode && !Kansen_mode ) {
learn_safu(hai);
}
anime_stehai(NewID,dl2,hai,(tehai->ippatu && tehai->reach));
/* graphics */
OldID = NewID;
prwcnt = 0;
for ( dl3 = 1; dl3 < 4; dl3++ ) { /* ロンできる */
if (Dir_ron((NewID+dl3)%4,hai)) {
break;
}
}
if ( (dl3 < 4) && ((NewID+dl3)%4 != 3) ) {
Oldhai = (haitype)hai;
nakimark(tehai);
NewID = (NewID+dl3)%4;
condition = COND_RON;
WaveFunc(condition,0);
break;
}
for ( dl3 = 1; dl3 < 4; dl3++ ) {
/* ==================Dir_naki================= */
if ( Kansen_mode ) {
jumpFlag=J_AS_CPKR1_KAN;
eFlag.act=AC_DEVIDE;
return;
ASK_SUB_CPKR1_KANSEN:
jumpFlag=J_DEFAULT;
work = Com_naki((NewID+dl3)%4,NewID,hai);
} else if ( (NewID+dl3)%4 == USRNO ) {
/* =====================Usr_naki==================== */
USR_stehai = -1;
pon_flag = FALSE;
kan_flag = FALSE;
chee_flag = FALSE;
tehai = &Member[(NewID+dl3)%4].tehai;
if ( !tehai->reach && !Haiteflag ) {
pon_flag = canpon(tehai,hai);
kan_flag = canmkan(tehai,hai);
if ( (((NewID+1) % 4) == (NewID+dl3)%4) ) {
chee_in = canchee(tehai,hai);
if ( chee_in != 0 ) {
chee_flag = TRUE;
}
}
}
ron_flag = FALSE;
if ( !tehai->furiten && canagari(tehai,hai) ) {
tehai->furiten = TRUE;
if ( getcalscr(tehai,hai,TRUE) != 0 ) {
ron_flag = TRUE;
}
}
init_top_eval((NewID+dl3)%4);
Hcnd = COND_THUMO;
if ( pon_flag && ponok((NewID+dl3)%4,hai) ) Hcnd = COND_PON;
if ( kan_flag && kanok((NewID+dl3)%4,hai) ) Hcnd = COND_MKAN;
if ( chee_flag ) {
Hin = cheeok((NewID+dl3)%4,hai);
if ( Hin ) Hcnd = COND_CHEE;
}
if ( ron_flag ) Hcnd = COND_RON;
switch ( Hcnd ) { /* 指示される行動 */
case COND_PON:
dla = DO_PON;
break;
case COND_CHEE:
dla = DO_CHEE;
break;
case COND_MKAN:
dla = DO_MKAN;
break;
case COND_THUMO:
dla = DO_STEHAI;
break;
case COND_RON:
dla = DO_RON;
break;
}
if ( !(Sinan_mode || Kansen_mode || Teach_mode) ) Hcnd = COND_THUMO;
if ( pon_flag || kan_flag || chee_flag || ron_flag ) {
/* ===================================ask_CPKR=========================*/
flush_stehai(NewID,0);
open_window_CPK(hai,tehai);
eFlag.act=AC_MOUSE;
/* ===================================ask_sub_CPKR=====================*/
Co = Member[NewID].tehai.count-1;
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
for (dlc=0 ; dlc<5 ; dlc++) {
switch (CPKR[dlc]) {
case COND_PON:
nakiMatrix[0]=1;
EnableMenuItem(hSubMenu, IDM_PON, MF_ENABLED);
break;
case COND_CHEE:
EnableMenuItem(hSubMenu, IDM_CHI, MF_ENABLED);
nakiMatrix[1]=1;
break;
case COND_MKAN:
EnableMenuItem(hSubMenu, IDM_KAN, MF_ENABLED);
nakiMatrix[2]=1;
break;
case COND_RON:
EnableMenuItem(hSubMenu, IDM_RON, MF_ENABLED);
nakiMatrix[4]=1;
break;
}
}
if (eFlag.act==AC_MOUSE) {
jumpFlag=J_ASK_SUB_CPKR1;
count_alltehai(NewID);
return;
}
ASK_SUB_CPKR1:
/* サブメニューのフリーズ */
jumpFlag=0;
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
DestroyMenuCheck();
MenuControl(2, MF_GRAYED);
cnd_dl1 = CPKR[CPK_point];
flush_stehai(NewID,1);
/* 離脱条件 :リターンが押されるまで
離脱時変化:cnd_dl1にCPRK配列の何が選択されたかを移す
以降、cnd_dl1 の値で判定を行う*/
/* ===================================ask_sub_CPKR=====================*/
if ( NewID >= 0 ) end_flush_stehai(NewID);
if ( cnd_dl1 == COND_CHEE ) Member[(NewID+dl3)%4].work = chee_work[get_gind(CPK_point)];
/* ===================================ask_CPKR=========================*/
if ( (cnd_dl1 == COND_CHEE) || (cnd_dl1 == COND_PON) ) Hp = tehai->count-3;
} else {
cnd_dl1 = COND_THUMO;
}
switch ( cnd_dl1 ) { /* 実行される行動 */
case COND_PON:
dlb = DO_PON;
break;
case COND_CHEE:
dlb = DO_CHEE;
break;
case COND_MKAN:
dlb = DO_MKAN;
break;
case COND_THUMO:
dlb = DO_STEHAI;
break;
case COND_RON:
dlb = DO_RON;
break;
}
if ( !Sinan_mode ) learn_naki(dla,dlb);
work=cnd_dl1;
/* =====================Usr_naki==================== */
} else {
jumpFlag=J_AS_CPKR1_COM;
eFlag.act=AC_DEVIDE;
return;
ASK_SUB_CPKR1_COMP:
jumpFlag=J_DEFAULT;
work = Com_naki((NewID+dl3)%4,NewID,hai);
}
WaveFunc(work,0);
/* ==================Dir_naki================= */
if ( Prw[work] > prwcnt ) {
workID = (NewID + dl3) % 4;
prwcnt = Prw[work];
workp = work;
}
}
if ( prwcnt == 0 ) {
OldID = (NewID+1) % 4;
NewID = OldID;
condition = COND_THUMO;
break;
}
Oldhai = (haitype)hai;
nakimark(tehai);
NewID = workID;
/* if ( workp == COND_RON ) play_ron(); */
condition = workp;
break;
case COND_TKAN:
tkan(tehai,Member[NewID].work);
if ( Ckanflag == 1 ) { /* graphics */
anime_akan(NewID,Member[NewID].work);
} else {
anime_pkan(NewID,Member[NewID].work);
}
clrippatu();
for ( dl3 = 1; dl3 < 4; dl3++ ) {
Oldhai = (haitype)Member[NewID].work;
/* dl5 = Dir_chankan((NewID+dl3) % 4, Oldhai);*/
/* =======================Dir_chankan========================= */
if ( !Kansen_mode && ((NewID+dl3)%4 == USRNO ) ) {
/* ===========================Usr_chankan============================= */
if ( ((Ckanflag != 1) && canagari(&Member[(NewID+dl3)%4].tehai,hai))
|| canckan(&Member[(NewID+dl3)%4].tehai,hai) ) {
pon_flag = FALSE;
chee_flag = FALSE;
kan_flag = FALSE;
ron_flag = TRUE;
/* ===============================ask_CPKR============================= */
open_window_CPK(hai,&Member[(NewID+dl3)%4].tehai);
eFlag.act=AC_MOUSE;
/* ===================================ask_sub_CPKR===================== */
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
for (dlc=0 ; dlc<5 ; dlc++) {
switch (RTK[dlc]) {
case COND_PON:
nakiMatrix[0]=1;
EnableMenuItem(hSubMenu, IDM_PON, MF_ENABLED);
break;
case COND_CHEE:
nakiMatrix[1]=1;
EnableMenuItem(hSubMenu, IDM_CHI, MF_ENABLED);
break;
case COND_MKAN:
EnableMenuItem(hSubMenu, IDM_KAN, MF_ENABLED);
nakiMatrix[2]=1;
break;
case COND_RON:
nakiMatrix[4]=1;
EnableMenuItem(hSubMenu, IDM_RON, MF_ENABLED);
break;
}
}
if (eFlag.act==AC_MOUSE) {
jumpFlag=J_ASK_SUB_CPKR2;
count_alltehai(NewID);
return;
}
ASK_SUB_CPKR2:
/* サブメニューのフリーズ */
jumpFlag=0;
memset(nakiMatrix,0x00,12);
memset(nakiChecker,0x00,12);
DestroyMenuCheck();
MenuControl(2, MF_GRAYED);
cnd_dl1 = CPKR[CPK_point];
/* 離脱条件 :リターンが押されるまで
離脱時変化:cnd_dl1にCPRK配列の何が選択されたかを移す
以降、cnd_dl1 の値で判定を行う*/
/* ===================================ask_sub_CPKR===================== */
if ( cnd_dl1 == COND_CHEE ) Member[(NewID+dl3)%4].work = chee_work[get_gind(CPK_point)];
dl6 = cnd_dl1;
/* ===============================ask_CPKR============================= */
if (dl6 == COND_RON) {
dl5 = TRUE;
} else {
dl5 = FALSE;
}
}
/* ===========================Usr_chankan============================= */
} else if ( ((Ckanflag != 1) && canagari(&Member[(NewID+dl3)%4].tehai,Oldhai))
|| canckan(&Member[(NewID+dl3)%4].tehai,Oldhai) ) {
dl5 = TRUE;
} else {
dl5 = FALSE;
}
/* =======================Dir_chankan========================= */
if ( dl5 ) {
OldID = NewID;
NewID = (NewID + dl3) % 4;
condition = COND_RON;
break;
}
}
WaveFunc(condition,1);
if (condition == COND_RON)
break;
if ( is4kan(NewID) ) {
Endflag = kan4;
condition = COND_END;
break;
}
Ckanflag = FALSE;
Kanflag = TRUE;
condition = COND_THUMO;
break;
case COND_MKAN:
mkan(tehai,Oldhai,relocate(NewID,OldID));
anime_mkan(NewID,OldID,Oldhai);
clrippatu();
if ( is4kan(NewID) ) {
Endflag = kan4;
condition = COND_END;
break;
}
Kanflag = TRUE;
condition = COND_THUMO;
break;
case COND_PON:
pon(tehai,Oldhai,relocate(NewID,OldID));
anime_pon(NewID,OldID,Oldhai);
/* graphics */
clrippatu();
condition = COND_STEHAI;
break;
case COND_CHEE:
chee(tehai,Oldhai,Member[NewID].work);
anime_chee(NewID,OldID);
/* graphics */
clrippatu();
condition = COND_STEHAI;
break;
default:
condition = COND_ERR;
}
if ( reach_num() == 4 ) { /* reach_numは判定関数 */
condition = COND_END;
Endflag = reach4;
}
if ( is4kaze() ) { /* is4kazeは判定関数 */
condition = COND_END;
Endflag = kaze4;
}
}
if ( (condition == COND_END) || (condition == COND_RON) ) {
/* 一局終了条件フラグon */
eFlag.tern=IC_KYOKUEND;
}
/* =========一局が終わるまで繰り返すらしい(^^;======== */
/* ここから下は全て判定・表示のたぐい */
/* 一局内状態では素通り */
if (eFlag.tern == IC_KYOKUEND) {
if ( !Sinan_mode && !Kansen_mode ) learn_yaku(2); /* 役の学習 */
if ( condition == COND_RON ) {
if ( (NewID != OldID) && (Member[OldID].tehai.reach)
&& (Member[OldID].tehai.ippatu) ) {
Member[OldID].score += 100;
Stick--;
del_reach_stick(OldID);
}
Member[NewID].tehai.open = TRUE;
put_alltehai(NewID);
anime_ron(NewID,(Kanflag)?NewID:OldID,Oldhai);
if ( Member[NewID].tehai.reach ) {
display_uradora(makedora());
} else {
display_uradora(makedummydora());
}
set_score(calscr(&Member[NewID].tehai,Oldhai,(NewID != OldID)));
DialogBox(hDlgInstance, "YakuWindow", hWnd, (DLGPROC)lpfnYakuDlgProc);
/* display_score(); */
DialogBox(hDlgInstance, "ScoreWindow", hWnd, (DLGPROC)lpfnScorDlgProc);
Stick = 0;
if ( (NewID == 3) && !Sinan_mode && !Kansen_mode )
learn_agari();
if ( (OldID == 3) && !Sinan_mode && !Kansen_mode )
learn_anpai();
} else if ( condition == COND_END ) {
if ( Endflag == ryukyoku ) {
for ( dl1 = 0; dl1 < 4; dl1++ ) { /* 流しマンガンOK */
if ( nagasi(&Member[dl1].tehai) ) na = dl1+1;
}
if ( na ) { /* 流しマンガン */
na--;
OldID = na;
NewID = na;
display_nagasi(Member[na].tehai.kaze == TON ? TRUE : FALSE);
set_score(Member[na].tehai.kaze == TON ? 1200 : 800);
DialogBox(hDlgInstance, "YakuWindow", hWnd, (DLGPROC)lpfnYakuDlgProc);
DialogBox(hDlgInstance, "ScoreWindow", hWnd, (DLGPROC)lpfnScorDlgProc);
/* display_score(); */
Stick = 0;
condition = COND_RON; /* 上がり役とする */
} else {
set_ryukyoku_score();
DialogBox(hDlgInstance, "Ryukyoku", hWnd, (DLGPROC)lpfnRyukDlgProc);
/* display_ryukyoku(); */
DialogBox(hDlgInstance, "ScoreWindow", hWnd, (DLGPROC)lpfnScorDlgProc);
/* display_score();*/
}
} else {
switch ( Endflag ) {
case kyushu:
strcpy(dispMessage," 九種九牌 ");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
Member[NewID].tehai.open = TRUE;
put_alltehai(NewID);
break;
case kan4:
strcpy(dispMessage," 四 開 槓 ");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
break;
case reach4:
strcpy(dispMessage,"四家リーチ");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
break;
case kaze4:
strcpy(dispMessage,"四風子連打");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
break;
}
/* Wait(-1); */
/* dispose_message(); */
}
}
/* 一局の判定 */
if ( (condition == COND_RON) && (Member[NewID].tehai.kaze != TON) ) {
Siba = 0;
tonke++;
} else {
Siba++;
if ( (condition == COND_END) && (Endflag == ryukyoku) && (Ba_mark == TON)
&& !tempai(&Member[ton_id].tehai) ) {
tonke++;
}
}
/* 半荘の終了判定 */
if (tonke>=4) {
tonke=0;
Ba_mark++;
if (Ba_mark>NAN) {
KillTimer(hWnd,ID_DISPTIME);
strcpy(dispMessage," 半荘終了 ");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
/* put_message(END_MSG); */
display_all_lastscore();
DialogBox(hDlgInstance, "TotalWindow", hWnd, (DLGPROC)lpfnTotaDlgProc);
Ba_mark=TON;
eFlag.tern = IC_HANEND;
MenuControl(0, MF_ENABLED);
MenuControl(2, MF_GRAYED);
MenuControl(1,0);
return;
}
}
InvalidateRect(hWnd, NULL, TRUE);
reaStick=Stick;
reach_mark=0;
}
if (eFlag.tern != IC_HANEND)
goto START;
}
/************************************************/
/* */
/* test main */
/* */
/************************************************/
/*
static menu_atom menu_atom2[] = {
{ "終 了",1 },
{ "継 続",0 },
};
static menu menu2 = { menu_atom2,2, };
static menu_atom menu_atomyn[] = {
{ "YES",1 },
{ "N O",0 },
};
static menu menuyn = { menu_atomyn,2, };
static menu_atom menu_atom3[] = {
{ "打ち手の交代",2 },
{ "名前の登録",1 },
{ "名前の変更",4 },
{ "終 了",3 },
{ "ユーティリティ",5 },
{ "メニュー",-1 },
};
static menu menu3 = { menu_atom3,6, };
static menu_atom menu_atom4[] = {
{ "観戦モード",1 },
{ "指南モード",2 },
{ "メニュー",-1 },
};
static menu menu4 = { menu_atom4,3, };
static menu_atom menu_atom5[] = {
{ "Bに初期ファイル作成",1 },
{ "AからBにデータ転送",2 },
{ "BからAにデータ転送",3 },
{ "メニュー",-1 },
};
static menu menu5 = { menu_atom5,4 };
*/
static void get_other(int sinan)
{
int *man_list;
int i;
man_list = pick_other(Member[3].men,sinan);
for ( i = 0; i < 3; i++ ) {
Member[i].men = man_list[i];
Wload(men[man_list[i]].network,i);
}
}
void MenuControl(int group,UINT flag)
{
switch (group) {
case 0:
hSubMenu=GetSubMenu(hMenu,0);
EnableMenuItem(hSubMenu, IDM_KACHI , flag);
EnableMenuItem(hSubMenu, IDM_KAKE , flag);
EnableMenuItem(hSubMenu, IDM_FREE , flag);
EnableMenuItem(hSubMenu, IDM_KANSEN, flag);
EnableMenuItem(hSubMenu, IDM_SHINAN, flag);
break;
case 1:
hSubMenu=GetSubMenu(hMenu,1);
if (flag==1) {
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
} else {
EnableMenuItem(hSubMenu, IDM_INIT, MF_ENABLED);
EnableMenuItem(hSubMenu, IDM_ENV, MF_GRAYED);
}
break;
case 2:
hSubMenu=GetSubMenu(hMenu,2);
EnableMenuItem(hSubMenu, IDM_PON, flag);
EnableMenuItem(hSubMenu, IDM_CHI, flag);
EnableMenuItem(hSubMenu, IDM_KAN, flag);
EnableMenuItem(hSubMenu, IDM_REA, flag);
EnableMenuItem(hSubMenu, IDM_RON, flag);
EnableMenuItem(hSubMenu, IDM_TUM, flag);
break;
}
}
/*=====================================================================
要約:ウインドウプログラムフック関数
書式:long FAR PASCAL _export WndProc(HWND hwnd,UINT message,
UINT wParam, LONG lParam);
概要:windowsアプリケーションの本体
=======================================================================*/
long FAR PASCAL _export WndProc(HWND hwnd,UINT message, UINT wParam,
LONG lParam)
{
static int mo = 1;
static int a, i, j, b, c, k;
static int saveflag;
static char msg[20];
static int rButtonFlag;
static int lButtonFlag;
DWORD lDlgBaseUnits;
static int xDlgBase,yDlgBase;
static int xPos,yPos;
static int hpbak;
static int nakiPoint;
static int nakiBak=0;
static PAINTSTRUCT ps;
static int CheckCont;
static HCURSOR hCur[2];
static int cpkrBak;
static int rtkBak;
static int openFlag;
int nakiSmall,nakiLarge,nakiPool,nakiSm,nakiLa,clFlag;
static int curFlag,curBak;
static int mciReturn;
static int eaBak;
static int eaBak2;
switch (message)
{
/*=====WM_CREATE========================================================*/
case WM_CREATE:
lDlgBaseUnits=GetDialogBaseUnits();
xDlgBase=LOWORD(lDlgBaseUnits);
yDlgBase=HIWORD(lDlgBaseUnits);
/* カーソルの変更 */
SetCursor(winCursor[0]);
ShowCursor(TRUE);
gSpeed=200;
eErr=TRUE;
doraFlag=0;
/* 各ダイアログアドレスの設定 */
hDlgInstance = ((LPCREATESTRUCT)lParam)->hInstance;
lpfnWndpDlgProc = MakeProcInstance((FARPROC)WndProc,hDlgInstance);
lpfnInitDlgProc = MakeProcInstance((FARPROC)InitDlgProc,hDlgInstance);
lpfnMastDlgProc = MakeProcInstance((FARPROC)MastDlgProc,hDlgInstance);
lpfnDekuDlgProc = MakeProcInstance((FARPROC)DekuDlgProc,hDlgInstance);
lpfnCharDlgProc = MakeProcInstance((FARPROC)CharDlgProc,hDlgInstance);
lpfnUtilDlgProc = MakeProcInstance((FARPROC)UtilDlgProc,hDlgInstance);
lpfnEnviDlgProc = MakeProcInstance((FARPROC)EnviDlgProc,hDlgInstance);
lpfnHa99DlgProc = MakeProcInstance((FARPROC)Ha99DlgProc,hDlgInstance);
lpfnDispDlgProc = MakeProcInstance((FARPROC)DispDlgProc,hDlgInstance);
lpfnScorDlgProc = MakeProcInstance((FARPROC)ScorDlgProc,hDlgInstance);
lpfnEScrDlgProc = MakeProcInstance((FARPROC)EScrDlgProc,hDlgInstance);
lpfnYakuDlgProc = MakeProcInstance((FARPROC)YakuDlgProc,hDlgInstance);
lpfnRyukDlgProc = MakeProcInstance((FARPROC)RyukDlgProc,hDlgInstance);
lpfnMesdDlgProc = MakeProcInstance((FARPROC)MesdDlgProc,hDlgInstance);
lpfnMemiDlgProc = MakeProcInstance((FARPROC)MemiDlgProc,hDlgInstance);
lpfnTotaDlgProc = MakeProcInstance((FARPROC)TotaDlgProc,hDlgInstance);
lpfnProfDlgProc = MakeProcInstance((FARPROC)ProfDlgProc,hDlgInstance);
lpfnKatiDlgProc = MakeProcInstance((FARPROC)KatiDlgProc,hDlgInstance);
lpfnChgpDlgProc = MakeProcInstance((FARPROC)ChgpDlgProc,hDlgInstance);
lpfnChgnDlgProc = MakeProcInstance((FARPROC)ChgnDlgProc,hDlgInstance);
lpfnFddsDlgProc = MakeProcInstance((FARPROC)FddsDlgProc,hDlgInstance);
lpfnChrEDlgProc = MakeProcInstance((FARPROC)ChrEDlgProc,hDlgInstance);
lpfnAbouDlgProc = MakeProcInstance((FARPROC)AbouDlgProc,hDlgInstance);
/* メニュー2群をアクティブ化 */
MenuControl(2, MF_GRAYED);
/* メニュー1群の環境設定のフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_ENV, MF_GRAYED);
rButtonFlag=0;
openFlag=0;
mastNo=255;
meijin=0;
Ba_mark = TON;
seFlag=1;
CheckCont=256;
eFlag.tern=IC_FIRST;
eFlag.proc=CC_DEFAULT;
eFlag.act=AC_DEFAULT;
if ( getenv("TMP") != NULL ) {
DebugMode = 1;
}
Sinan_mode = FALSE;
while ( !load_all_man(1) ) {
break;
}
a = Member[3].men;
eErr=Wload(men[a].network,3);
saveflag = FALSE;
if ( Sinan_mode )
eErr=Wload(men[Member[3].men].network,3);
return 0;
/*=====WM_CREATE========================================================*/
/*=====WM_COMMAND=======================================================*/
case WM_COMMAND:
switch (eFlag.tern) {
case IC_FIRST: /* ゲーム開始前 */
if ( saveflag ) {
Wsave(men[Member[3].men].network);
save_all_man();
saveflag = FALSE;
}
ExTopMenu = 1;
Game_mode = message-10+1;
Kansen_mode = FALSE;
Sinan_mode = FALSE;
switch (wParam) {
case IDM_EXIT: /* 終了 */
SendMessage(hwnd, WM_CLOSE, 0 ,0L);
return 0;
case IDM_KACHI: /* 名人戦 */
a = Member[3].men;
b = (men[a].rank-1);
if ( b == 0 ) b = 1;
if ( b < 0 ) b = 0;
if ( b > 13 ) b = 13;
c = 0;
for ( i = 0; i < 17; i++ ) {
if ( (a != i) && (men[i].rank >= b) && (men[i].rank < b+4) ) {
Member[c].men = i;
eErr=Wload(men[i].network,c++);
}
}
Display_Option = 2;
saveflag = TRUE;
/* ここでダイアログボックスでぷれいやー確認 */
if (!DialogBox(hDlgInstance, "KachiProf", hwnd, (DLGPROC)lpfnKatiDlgProc)) {
return 0;
}
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_KACHI;
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
/* メニュー1群の環境設定のアクティブ化 */
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
/* PostMessage(hwnd, WM_USER+104, 0, 0L); */
if (NewID!=3)
PostMessage(hwnd, WM_USER+103, 0, 0L);
return 0;
case IDM_KAKE: /* 賭け麻雀 */
Display_Option = 0;
saveflag = TRUE;
/* ここでダイアログボックスでぷれいやー洗濯 */
if (!DialogBox(hDlgInstance, "CharSelect", hwnd, (DLGPROC)lpfnCharDlgProc)) {
return 0;
}
/* レート表示 */
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_KAKE;
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
/* メニュー1群の環境設定のアクティブ化 */
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
if (NewID!=3)
PostMessage(hwnd, WM_USER+103, 0, 0L);
return 0;
case IDM_FREE:
Display_Option = 2;
/* ここでダイアログボックスでぷれいやー洗濯 */
if (!DialogBox(hDlgInstance, "CharSelect", hwnd, (DLGPROC)lpfnCharDlgProc)) {
return 0;
}
saveflag = TRUE;
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_FREE;
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
/* メニュー1群の環境設定のアクティブ化 */
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
if (NewID!=3)
PostMessage(hwnd, WM_USER+103, 0, 0L);
return 0;
case IDM_KANSEN:
Display_Option = 2;
Kansen_mode = TRUE;
if (!DialogBox(hDlgInstance, "CharSelect", hwnd, (DLGPROC)lpfnCharDlgProc)) {
mastNo=255;
Kansen_mode = FALSE;
return 0;
}
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_KANSEN;
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー2群をブロック */
MenuControl(2, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
/* メニュー1群の環境設定のアクティブ化 */
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
PostMessage(hwnd, WM_USER+103, 0, 0L);
return 0;
case IDM_SHINAN:
Sinan_mode = TRUE;
Wsave(men[Member[3].men].network);
/* 師匠選択 */
if (!DialogBox(hDlgInstance, "MastSelect", hwnd, (DLGPROC)lpfnMastDlgProc)) {
mastNo=255;
Sinan_mode = FALSE;
return 0;
}
/* メンバー選択 */
if (!DialogBox(hDlgInstance, "DekuSelect", hwnd, (DLGPROC)lpfnDekuDlgProc)) {
mastNo=255;
Sinan_mode = FALSE;
return 0;
}
Display_Option = 2;
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_SHINAN;
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_GRAYED);
/* メニュー1群の環境設定のアクティブ化 */
EnableMenuItem(hSubMenu, IDM_ENV, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
if (NewID!=3)
PostMessage(hwnd, WM_USER+103, 0, 0L);
return 0;
case IDM_INIT:
DialogBox(hDlgInstance, "InitMenu", hwnd, (DLGPROC)lpfnInitDlgProc);
return 0;
case IDM_NOMIDI:
MusicClose();
return 0;
case IDM_MUSIC1:
MusicClose();
MusicPlay(hwnd,0);
return 0;
case IDM_MUSIC2:
MusicClose();
MusicPlay(hwnd,1);
return 0;
case IDM_MUSIC3:
MusicClose();
MusicPlay(hwnd,2);
return 0;
case IDM_MUSIC4:
MusicClose();
MusicPlay(hwnd,3);
return 0;
case IDM_MUSIC5:
MusicClose();
MusicPlay(hwnd,4);
return 0;
case IDM_MUSIC6:
MusicClose();
MusicPlay(hwnd,5);
return 0;
case IDM_SEON:
hSubMenu=GetSubMenu(hMenu,1);
CheckMenuItem(hSubMenu, IDM_SEOFF, MF_ENABLED);
CheckMenuItem(hSubMenu, IDM_SEON , MF_CHECKED);
seFlag=1;
return 0;
case IDM_SEOFF:
hSubMenu=GetSubMenu(hMenu,1);
CheckMenuItem(hSubMenu, IDM_SEOFF, MF_CHECKED);
CheckMenuItem(hSubMenu, IDM_SEON , MF_ENABLED);
seFlag=0;
return 0;
case IDM_ABOUT:
DialogBox(hDlgInstance, "ABOUTDLGBOX", hwnd, (DLGPROC)lpfnAbouDlgProc);
return 0;
case IDM_MEMINFO:
DialogBox(hDlgInstance, "MEM_INFO", hwnd, (DLGPROC)lpfnMemiDlgProc);
return 0;
}
default:
if (CheckCont==256) {
cpkrBak=CPK_point;
rtkBak=RTK_point;
}
switch (wParam) {
case IDM_EXIT: /* 終了 */
SendMessage(hwnd, WM_CLOSE, 0 ,0L);
return 0;
case IDM_PON:
/* ポップアップメニュー項目のチェック(フリップフロップ) */
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_PON,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[0]=0x01;
if (CheckCont!=256) {
nakiChecker[CheckCont-0x31]=0x00;
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
if (CheckCont==IDM_PON) {
nakiChecker[0]=0x00;
CheckCont=256;
CPK_point=cpkrBak;
dispose_gind();
return 0;
}
}
CheckCont=IDM_PON;
for (i=0 ; i<4 ;i++) {
if (CPKR[i]==COND_PON) {
CPK_point=i;
break;
}
}
dispose_gind();
display_gind(CPK_point);
return 0;
case IDM_CHI:
/* ポップアップメニュー項目のチェック(フリップフロップ) */
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_CHI,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[1]=0x01;
if (CheckCont!=256) {
nakiChecker[CheckCont-0x31]=0x00;
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
if (CheckCont==IDM_CHI) {
nakiChecker[1]=0x00;
CheckCont=256;
CPK_point=cpkrBak;
dispose_gind();
return 0;
}
}
CheckCont=IDM_CHI;
for (i=0 ; i<4 ;i++) {
if (CPKR[i]==COND_CHEE) {
CPK_point=i;
break;
}
}
dispose_gind();
display_gind(CPK_point);
return 0;
case IDM_KAN:
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_KAN,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[2]=0x01;
if (CheckCont!=256) {
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
nakiChecker[CheckCont-0x31]=0x00;
if (CheckCont==IDM_KAN) {
nakiChecker[2]=0x00;
CPK_point=cpkrBak;
RTK_point=rtkBak;
CheckCont=256;
dispose_gind();
return 0;
}
}
CheckCont=IDM_KAN;
if (jumpFlag==J_ASK_SUB_CPKR1||jumpFlag==J_ASK_SUB_CPKR2) {
for (i=0 ; i<4 ;i++) {
if (CPKR[i]==COND_MKAN) {
CPK_point=i;
break;
}
}
dispose_gind();
display_gind(CPK_point);
} else if (jumpFlag==J_ASK_SUB_RTK) {
for (i=0 ; i<4 ;i++) {
if (RTK[i]==COND_TKAN) {
RTK_point=i;
break;
}
}
dispose_gind();
display_gind(RTK_point);
}
return 0;
case IDM_REA:
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_REA,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[3]=0x01;
if (CheckCont!=256) {
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
nakiChecker[CheckCont-0x31]=0x00;
if (CheckCont==IDM_REA) {
nakiChecker[3]=0x00;
RTK_point=rtkBak;
CheckCont=256;
unindicate_hai(Hp);
return 0;
}
}
CheckCont=IDM_REA;
for (i=0 ; i<4 ;i++) {
if (RTK[i]==COND_REACH) {
RTK_point=i;
break;
}
}
return 0;
case IDM_RON:
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_RON,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[4]=0x01;
if (CheckCont!=256) {
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
nakiChecker[CheckCont-0x31]=0x00;
if (CheckCont==IDM_RON) {
nakiChecker[4]=0x00;
CPK_point=cpkrBak;
CheckCont=256;
dispose_gind();
return 0;
}
}
CheckCont=IDM_RON;
for (i=0 ; i<4 ;i++) {
if (CPKR[i]==COND_RON) {
CPK_point=i;
break;
}
}
dispose_gind();
display_gind(CPK_point);
return 0;
case IDM_TUM:
hSubMenu=GetSubMenu(hMenu,2);
CheckMenuItem(hSubMenu, IDM_TUM,MF_BYCOMMAND|MF_CHECKED);
nakiChecker[5]=0x01;
if (CheckCont!=256) {
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
nakiChecker[CheckCont-0x31]=0x00;
if (CheckCont==IDM_TUM) {
nakiChecker[5]=0x00;
RTK_point=rtkBak;
CheckCont=256;
dispose_gind();
return 0;
}
}
CheckCont=IDM_TUM;
for (i=0 ; i<4 ;i++) {
if (RTK[i]==COND_RON) {
RTK_point=i;
break;
}
}
return 0;
case IDM_ABOUT:
DialogBox(hDlgInstance, "ABOUTDLGBOX", hwnd, (DLGPROC)lpfnAbouDlgProc);
return 0;
case IDM_MEMINFO:
DialogBox(hDlgInstance, "MEM_INFO", hwnd, (DLGPROC)lpfnMemiDlgProc);
return 0;
case IDM_HELP:
HelpProc();
return 0;
case IDM_ENV:
eaBak=eFlag.act;
eFlag.act=AC_STOP;
if (DialogBox(hDlgInstance, "ENVIROMENT", hwnd, (DLGPROC)lpfnEnviDlgProc)==FALSE) {
KillTimer(hWnd,ID_DISPTIME);
mastNo=255;
Sinan_mode = FALSE;
Kansen_mode = FALSE;
Ba_mark=TON;
openFlag = 1;
meijin=0;
eFlag.tern=IC_FIRST;
eFlag.proc=CC_DEFAULT;
eFlag.proc=AC_DEFAULT;
jumpFlag=J_DEFAULT;
MenuControl(0, MF_ENABLED);
MenuControl(2, MF_GRAYED);
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_ENV, MF_GRAYED);
EnableMenuItem(hSubMenu, IDM_INIT,MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
MusicClose();
MusicPlay(hwnd,0);
break;
}
eFlag.act=eaBak;
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
return 0;
case IDM_SEON:
hSubMenu=GetSubMenu(hMenu,1);
CheckMenuItem(hSubMenu, IDM_SEOFF, MF_ENABLED);
CheckMenuItem(hSubMenu, IDM_SEON , MF_CHECKED);
seFlag=1;
return 0;
case IDM_SEOFF:
hSubMenu=GetSubMenu(hMenu,1);
CheckMenuItem(hSubMenu, IDM_SEOFF, MF_CHECKED);
CheckMenuItem(hSubMenu, IDM_SEON , MF_ENABLED);
seFlag=0;
return 0;
case IDM_NOMIDI:
MusicClose();
return 0;
case IDM_MUSIC1:
MusicClose();
MusicPlay(hwnd,0);
return 0;
case IDM_MUSIC2:
MusicClose();
MusicPlay(hwnd,1);
return 0;
case IDM_MUSIC3:
MusicClose();
MusicPlay(hwnd,2);
return 0;
case IDM_MUSIC4:
MusicClose();
MusicPlay(hwnd,3);
return 0;
case IDM_MUSIC5:
MusicClose();
MusicPlay(hwnd,4);
return 0;
case IDM_MUSIC6:
MusicClose();
MusicPlay(hwnd,5);
return 0;
}
}
break;
case MM_MCINOTIFY:
if (wParam==MCI_NOTIFY_SUCCESSFUL)
MusicReplay(hwnd);
break;
case WM_PALETTECHANGED:
if (wParam==hwnd)
return 0L;
case WM_QUERYNEWPALETTE:
hdc = GetDC(hwnd) ;
if (openFlag==1&&eFlag.tern==IC_FIRST&&meijin!=1)
OpenPut2(hdc);
ReleaseDC(hwnd, hdc) ;
break;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
/* オープニングBMPのプット */
if (openFlag==0) {
systemError=0;
OpenLoad();
if (systemError==1) {
MessageBox(hwnd, "メモリーが足りません! 他のアプリケーションを\n終了させるなどして十分なメモリを確保してから\n再度立ち上げてください", "警告", MB_ICONEXCLAMATION|MB_OK);
SendMessage(hwnd, WM_CLOSE, 0 ,0L);
return 0;
}
Ginit();
OpenPut2(hdc);
/* SetTimer(hwnd,ID_DISPTIME,5000,lpfnWndpDlgProc); */
openFlag=1;
SoundSetUp();
MusicPlay(hwnd,0);
hSubMenu=GetSubMenu(hMenu,1);
CheckMenuItem(hSubMenu, IDM_SEOFF, MF_ENABLED);
CheckMenuItem(hSubMenu, IDM_SEON , MF_CHECKED);
seFlag=1;
EndPaint (hwnd, &ps) ;
break;
}
switch (eFlag.tern) {
case IC_FIRST:
/* メニュー項目の設定行動メニューの封印 */
MenuControl(2, MF_GRAYED);
/* メニュー1初期設定をフリーズ */
hSubMenu=GetSubMenu(hMenu,1);
EnableMenuItem(hSubMenu, IDM_INIT, MF_ENABLED);
if (openFlag==1&&meijin!=1) {
OpenPut2(hdc);
}
break;
case IC_PLAYERSEL: /* キャラクター選択後 */
InvalidateRect(hWnd, NULL, TRUE);
break;
case IC_KYOKU: /* 1局中 */
if (eFlag.act==AC_MOUSE||eFlag.act==AC_DEVIDE||eFlag.act==AC_STOP) {
for ( i = 0; i < 4; i++ ) {
put_alltehai(i); /* graphics */
}
display_dora();
display_sai();
disp_naki();
display_hyochar(Siba,reaStick);
display_bahyoji();
display_stehai();
Display_reach_b();
if (jumpFlag!=J_USR_STEHAI&&(eFlag.act==AC_MOUSE||eFlag.act==AC_STOP))
if (jumpFlag!=J_ASK_SUB_RTK)
flush_stehai(NewID,0);
if ((eFlag.act==AC_MOUSE||eFlag.act==AC_STOP)&&jumpFlag==J_USR_STEHAI) {
indicate_hai(Hp);
break;
}
if ((eFlag.act==AC_MOUSE||eFlag.act==AC_STOP)&&jumpFlag!=J_USR_STEHAI&&CheckCont!=256) {
dispose_gind();
display_gind(CPK_point);
break;
}
}
}
EndPaint (hwnd, &ps) ;
return 0;
case WM_TIMER:
if (eFlag.act==AC_DEVIDE)
PostMessage(hwnd, WM_USER+103, 0, 0L);
if (eFlag.tern==IC_HANEND)
PostMessage(hwnd, WM_USER+103, 0, 0L);
break;
case WM_KILLFOCUS:
eaBak2=eFlag.act;
eFlag.act=AC_STOP;
break;
case WM_SETFOCUS:
eFlag.act=eaBak2;
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
break;
case WM_SIZE:
if (eFlag.tern==IC_FIRST&&eFlag.act==AC_DEFAULT) {
if (wParam!=SIZE_MINIMIZED) {
SetWindowPos(hwnd, (HWND)NULL, 0, 0,
540, 400+GetSystemMetrics(SM_CYMENU)+GetSystemMetrics(SM_CYCAPTION),
SWP_NOMOVE|SWP_NOZORDER);
}
}
if (wParam==SIZE_MINIMIZED&&eFlag.act==AC_DEVIDE) {
eFlag.act=AC_ICONSIZE;
} else if (eFlag.proc==CC_KANSEN) {
eFlag.act=AC_DEVIDE;
}
break;
/* case WM_USER+104:
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
if (eFlag.proc==CC_KANSEN&&eFlag.act==AC_DEVIDE)
SetTimer(hwnd,ID_DISPTIME,100,lpfnWndpDlgProc);
break; */
case WM_USER+103:
if (eFlag.tern==IC_FIRST)
break;
if (eFlag.tern!=IC_HANEND) {
display_dora();
display_sai();
display_hyochar(Siba,reaStick);
display_bahyoji();
Display_reach_b();
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
if (jumpFlag!=J_USR_STEHAI&&NewID == USRNO ) {
CreateNakiMenu(lParam);
KillPopMenu();
}
}
if (eFlag.tern==IC_HANEND) {
if (eFlag.proc==CC_KACHI) {
a = get_topman();
if ( men[a].rank > b && meijin==0) {
b = men[a].rank - 1;
for ( i = 0; i < 17; ++i ) {
if ( men[i].rank == b ) {
men[i].rank++;
break;
}
}
men[a].rank--;
save_all_man();
MusicClose();
MusicPlay(hwnd,0);
} else if ( a == Member[3].men && men[a].rank == 1 ) {
b = 0;
c = 0;
meijin=1;
save_all_man();
for ( i = 0; i < 17; i++ ) {
if ( (a != i) && (men[i].rank >= b) && (men[i].rank < b+4) ) {
Member[c].men = i;
eErr=Wload(men[i].network,c++);
}
}
Display_Option = 2;
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_KACHI;
DialogBox(hDlgInstance, "KachiProf", hwnd, (DLGPROC)lpfnKatiDlgProc);
MenuControl(1,1);
strcpy(dispMessage,"名 人 戦");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
/* メニュー0群をブロック */
MenuControl(0, MF_GRAYED);
/* メニュー2群をアクティブ化 */
MenuControl(2, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
/* if (jumpFlag!=J_USR_STEHAI&&NewID == USRNO ) {
CreateNakiMenu(lParam);
KillPopMenu();
}
*/
meijin=0;
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
break;
}
}
if (eFlag.proc==CC_KAKE) {
for ( i = 0; i < 4; i++ ) {
men[Member[i].men].money += last_sc[i]*a;
}
save_all_man();
}
eFlag.tern=IC_FIRST;
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
InvalidateRect(hWnd, NULL, TRUE);
meijin=0;
break;
/* その他、初期化処理 */
}
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
return 0;
case WM_MOUSEMOVE:
curFlag=TRUE;
xPos = LOWORD(lParam); /* マウスカーソルの水平位置 */
yPos = HIWORD(lParam); /* マウスカーソルの垂直位置 */
if (eFlag.act==AC_MOUSE) {
if (ysClip<yPos&&yeClip>yPos&&xsClip<xPos&&xeClip>xPos) {
if (jumpFlag==J_USR_STEHAI||(jumpFlag==J_ASK_SUB_RTK&&CheckCont!=IDM_KAN&&NewID==USRNO)) {
/* if (jumpFlag==J_USR_STEHAI||CheckCont==IDM_REA) {
*/ hpbak=Hp;
Hp=(xPos-base_x[SHITA]-1)/hai_w[SHITA];
if (Hp<=Co) {
/* カーソルの変更 */
curFlag=FALSE;
if (curBak!=FALSE) {
SetCursor(winCursor[3]);
ShowCursor(TRUE);
curBak=FALSE;
}
if (Hp!=hpbak) {
unindicate_hai(hpbak);
indicate_hai(Hp);
}
}
} else {
if (jumpFlag==J_ASK_SUB_RTK) {
if (CheckCont==IDM_KAN) {
nakiPoint=(xPos-base_x[SHITA])/hai_w[SHITA];
if (nakiPoint!=nakiBak) {
nakiSmall=14;
nakiLarge=0;
for (i=0 ; i<7 ; i++) {
nakiPool=0;
for (j=0 ; j<4 ; j++)
nakiPool+=ind_group[i][j];
if (nakiPool==0)
break;
for (j=0 ; j<4 ; j++) {
if (nakiSmall>ind_group[i][j]&&ind_group[i][j]!=-1)
nakiSmall=ind_group[i][j];
if (nakiLarge<ind_group[i][j]&&ind_group[i][j]!=-1)
nakiLarge=ind_group[i][j];
}
}
if (nakiPoint>=nakiSmall&&nakiPoint<=nakiLarge) {
/* カーソルの変更 */
curFlag=FALSE;
if (curBak!=FALSE) {
SetCursor(winCursor[3]);
ShowCursor(TRUE);
curBak=FALSE;
}
if (nakiPoint>nakiBak) {
right_gind(RTK_point);
} else if (nakiPoint<nakiBak) {
left_gind(RTK_point);
}
}
dispose_gind();
display_gind(RTK_point);
nakiBak=nakiPoint;
}
}
} else {
if (CheckCont!=256) {
nakiPoint=(xPos-base_x[SHITA])/hai_w[SHITA];
if (nakiPoint!=nakiBak) {
nakiSmall=14;
nakiLarge=0;
for (i=0 ; i<7 ; i++) {
nakiPool=0;
for (j=0 ; j<4 ; j++)
if (ind_group[i][j]!=-1)
nakiPool+=ind_group[i][j];
if (nakiPool==0)
break;
for (j=0 ; j<gind_cnt[CPK_point] ; j++) {
if (nakiSmall>ind_group[i][j]&&ind_group[i][j]!=-1)
nakiSmall=ind_group[i][j];
if (nakiLarge<ind_group[i][j]&&ind_group[i][j]!=-1)
nakiLarge=ind_group[i][j];
}
}
for (i=0 ; i<4 ; i++) {
if (nakiMarks[i]!=0) {
nakiSm=nakiMarks[i];
break;
}
}
for (i=3 ; i>=0 ; i--) {
if (nakiMarks[i]!=0) {
nakiLa=nakiMarks[i];
break;
}
}
if (nakiPoint>=nakiSmall&&nakiPoint<=nakiLarge) {
/* カーソルの変更 */
curFlag=FALSE;
if (curBak!=FALSE) {
SetCursor(winCursor[3]);
ShowCursor(TRUE);
curBak=FALSE;
}
if (nakiPoint>nakiBak&&nakiLa<nakiLarge) {
right_gind(CPK_point);
} else if (nakiPoint<nakiBak&&nakiSm>nakiSmall) {
left_gind(CPK_point);
}
dispose_gind();
display_gind(CPK_point);
nakiBak=nakiPoint;
}
}
}
}
}
}
}
if (curFlag==TRUE) {
if (curBak!=TRUE) {
SetCursor(winCursor[1]);
ShowCursor(TRUE);
curBak=TRUE;
}
}
break;
case WM_RBUTTONDOWN:
if (eFlag.proc==CC_KANSEN&&eFlag.act==AC_DEVIDE)
break;
if (jumpFlag==J_ASK_SUB_RTK||jumpFlag==J_ASK_SUB_CPKR1||jumpFlag==J_ASK_SUB_CPKR2) {
CreateNakiMenu(lParam);
KillPopMenu();
}
break;
/* case WM_RBUTTONUP:
if (eFlag.proc==CC_KANSEN&&eFlag.act==AC_DEVIDE)
break;
if (jumpFlag==J_ASK_SUB_RTK||jumpFlag==J_ASK_SUB_CPKR1||jumpFlag==J_ASK_SUB_CPKR2) {
}
break; */
case WM_KEYUP:
/* sprintf(msg,"key=[%d]",wParam);
MessageBox(hwnd, msg,"KEY", MB_ICONEXCLAMATION|MB_OK); */
if (wParam!=0x0d)
break;
case WM_LBUTTONUP:
if (eFlag.proc==CC_KANSEN&&eFlag.act==AC_DEVIDE)
break;
clFlag=0;
/* xPos = LOWORD(lParam); マウスカーソルの水平位置 */
/* yPos = HIWORD(lParam); マウスカーソルの垂直位置 */
if (jumpFlag==J_ASK_SUB_RTK) {
if (ysClip>yPos||yeClip<yPos)
break;
else if (xsClip>xPos||xeClip<xPos)
break;
}
if (jumpFlag==J_USR_STEHAI||CheckCont==IDM_REA) {
if (ysClip<yPos&&yeClip>yPos) {
if (xsClip<xPos&&xeClip>xPos) {
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(hSubMenu, CheckCont,MF_BYCOMMAND|MF_UNCHECKED);
hpbak=Hp;
Hp=(xPos-base_x[SHITA])/hai_w[SHITA];
clFlag=1;
if (reaSteFlag>1) {
Hp=TP[3].Tcn;
} else if (Hp>Co) {
break;
}
if (Hp<=Co) {
unindicate_hai(hpbak);
}
}
}
} else if (jumpFlag==J_ASK_SUB_RTK||jumpFlag==J_ASK_SUB_CPKR1||jumpFlag==J_ASK_SUB_CPKR2) {
dispose_gind();
clFlag=1;
if (Hp>Co) {
Hp=TP[3].Tcn;
}
} else {
break;
}
if (clFlag==0)
break;
CheckCont=256;
/* 牌の数だけ消しちゃったりするぞルーチンはさみ場所 */
ClearGomi(TP[3].Tcn+1);
switch (eFlag.proc) {
case CC_KACHI:
/* hanchan(hwnd,WM_LBUTTONUP,eFlag.tern,eFlag.proc);
if (eFlag.tern==IC_HANEND) {
eFlag.tern=IC_FIRST;
a = get_topman();
if ( men[a].rank > b ) {
b = men[a].rank - 1;
for ( i = 0; i < 17; ++i ) {
if ( men[i].rank == b ) {
men[i].rank++;
break;
}
}
men[a].rank--;
save_all_man();
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
InvalidateRect(hWnd, NULL, TRUE);
meijin=0;
} else if ( a == Member[3].men && men[a].rank == 1 ) {
b = 0;
c = 0;
meijin=1;
save_all_man();
for ( i = 0; i < 17; i++ ) {
if ( (a != i) && (men[i].rank >= b) && (men[i].rank < b+4) ) {
Member[c].men = i;
eErr=Wload(men[i].network,c++);
}
}
Display_Option = 2;
if (!DialogBox(hDlgInstance, "KachiProf", hwnd, (DLGPROC)lpfnKatiDlgProc)) {
return 0;
}
eFlag.tern=IC_PLAYERSEL;
eFlag.proc=CC_KACHI;
MenuControl(1,1);
strcpy(dispMessage,"名 人 戦");
DialogBox(hDlgInstance, "MessageDisplay", hWnd, (DLGPROC)lpfnMesdDlgProc);
メニュー0群をブロック
MenuControl(0, MF_GRAYED);
メニュー2群をアクティブ化
MenuControl(2, MF_ENABLED);
InvalidateRect(hWnd, NULL, TRUE);
hanchan(hwnd,WM_PAINT,eFlag.tern,eFlag.proc);
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
break;
} else {
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
InvalidateRect(hWnd, NULL, TRUE);
meijin=0;
}
} else {
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
}
*/
PostMessage(hwnd, WM_USER+103, 0, 0L);
break;
case CC_KAKE:
hanchan(hwnd,WM_LBUTTONUP,eFlag.tern,eFlag.proc);
if (eFlag.tern==IC_HANEND) {
for ( i = 0; i < 4; i++ ) {
men[Member[i].men].money += last_sc[i]*a;
}
eFlag.tern=IC_FIRST;
save_all_man();
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
/* その他、初期化処理 */
} else {
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
}
break;
case CC_FREE:
hanchan(hwnd,WM_LBUTTONUP,eFlag.tern,eFlag.proc);
if (eFlag.tern==IC_HANEND) {
eFlag.tern=IC_FIRST;
/* その他、初期化処理 */
save_all_man();
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
} else {
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
}
break;
case CC_KANSEN:
hanchan(hwnd,WM_LBUTTONUP,eFlag.tern,eFlag.proc);
if (eFlag.tern==IC_HANEND) {
eFlag.tern=IC_FIRST;
mastNo=255;
/* その他、初期化処理 */
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
}
break;
case CC_SHINAN:
hanchan(hwnd,WM_LBUTTONUP,eFlag.tern,eFlag.proc);
if (eFlag.tern==IC_HANEND) {
eFlag.tern=IC_FIRST;
eErr=Wload(men[Member[3].men].network,3);
Sinan_mode = FALSE;
mastNo=255;
/* その他、初期化処理 */
openFlag=1;
MusicClose();
MusicPlay(hwnd,0);
} else {
SetTimer(hwnd,ID_DISPTIME,gSpeed,lpfnWndpDlgProc);
}
}
break;
case WM_DESTROY:
if (systemError==0) {
CloseHai();
OpenDelete();
}
MusicClose();
PostQuitMessage(0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
/*
static int utility(void)
{
int t;
int a;
int st = 0;
int st2 = 0;
int dsk_flg;
setcolor_menu(BLACK);
init_menu(&menu5);
open_menu(&menu5,350,280);
a = get_term_menu();
close_menu();
setcolor_menu(DARK_BLUE);
switch ( a ) {
case 1:
setcolor_menu(BLACK);
display_message_xy(FMT_MSG,3,33,308,BLACK);
init_menu(&menuyn);
open_menu(&menuyn,63*8,364);
do {
t = get_term_menu();
} while ( t < 0 );
close_menu();
dispose_message();
if ( t ) {
st2 = init_member_data(1);
}
setcolor_menu(DARK_BLUE);
break;
case 2:
転送A>B
display_message_xy(TR_AB_MSG,3,30,300,BLACK);
while ( get_stick() == 0 )
;
dispose_message();
st = pick_member(0);
if ( st > 0 ) {
st2 = trans_member(1);
}
if ( st == -1 ) {
st = 0;
st2 = -1;
} else {
st = 1;
}
break;
case 3:
転送B>A
display_message_xy(TR_BA_MSG,3,30,300,BLACK);
while ( get_stick() == 0 )
;
dispose_message();
st = pick_member(1);
if ( st > 0 ) {
st2 = trans_member(0);
}
if ( st == -1 ) {
st = 0;
st2 = -1;
} else {
st = 1;
}
break;
}
setcolor_menu(BLACK);
if ( st2 == -1 ) {
display_message_xy(CANSEL_MSG,2,33,308,BLACK);
while ( get_stick() == 0 )
;
dispose_message();
}
dsk_flg = 0;
while ( !load_all_man(1) ) {
get_stick();
if ( !dsk_flg ) {
display_message_xy(SET_DSK_MSG,2,33,308,BLACK);
}
dsk_flg = 1;
}
if ( dsk_flg ) {
dispose_message();
}
setcolor_menu(DARK_BLUE);
a = Member[3].men;
Wload(men[a].network,3);
return st;
}
*/
BOOL FAR PASCAL _export InitDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
lParam++;
lParam--;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
return FALSE;
case WM_COMMAND :
switch (wParam) {
case EXEC_FUNC_B:
if (IsDlgButtonChecked(hDlg, CHG_PLAYER_R)!=0)
DialogBox(hDlgInstance, "ChangePlayer", hDlg, (DLGPROC)lpfnChgpDlgProc);
if (IsDlgButtonChecked(hDlg, CHG_NAME_R)!=0)
DialogBox(hDlgInstance, "ChangeName", hDlg, (DLGPROC)lpfnChgnDlgProc);
if (IsDlgButtonChecked(hDlg, INP_CHAR_R)!=0)
DialogBox(hDlgInstance, "CharEntry", hDlg, (DLGPROC)lpfnChrEDlgProc);
if (IsDlgButtonChecked(hDlg, SEL_UTL_R)!=0)
DialogBox(hDlgInstance, "Utility", hDlg, (DLGPROC)lpfnUtilDlgProc);
return 0;
case INIT_RET:
EndDialog(hDlg, TRUE);
return 0;
}
break;
}
return FALSE;
}
/* 勝ち抜き戦用キャラクター表示ダイアログ */
BOOL FAR PASCAL _export KatiDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
int i,j;
char charName[32];
char charMoney1[32];
char charMoney2[32];
char fileName[20];
char *filePoint;
static char *fileBuffer;
static FILE *fp;
long fileSize;
/*HDC dlgHdc;*/
switch (message) {
case WM_INITDIALOG :
/* SetTimer(hDlg,ID_DISPTIME,20000,lpfnKatiDlgProc); */
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_PAINT:
for (j=0 ; j<3 ; j++) {
memset(charName,0x00,32);
strcpy(charName,men[Member[j].men].name);
SetDlgItemText(hDlg, PROF_NAME1+j,charName);
if (men[Member[j].men].rank==0) {
strcpy(charName,"名人");
} else {
itoa(men[Member[j].men].rank,charName,10);
strcat(charName,"位");
}
SetDlgItemText(hDlg, RANK1+j,charName);
itoa(men[Member[j].men].money,charMoney2,10);
if (men[Member[j].men].money<0) {
strcpy(charMoney1,"-");
for (i=0 ; i<(int)(6-strlen(charMoney2)-1) ; i++)
strcat(charMoney1," ");
for (i=0 ; i<(int)strlen(charMoney2)-1 ; i++) {
strcat(charMoney1,"0");
charMoney1[strlen(charMoney1)-1]+=(char)(charMoney2[i+1]-0x30);
}
} else {
strcpy(charMoney1," ");
for (i=0 ; i<(int)(6-strlen(charMoney2)) ; i++)
strcat(charMoney1," ");
for (i=0 ; i<(int)strlen(charMoney2) ; i++) {
strcat(charMoney1,"0");
charMoney1[strlen(charMoney1)-1]+=(char)(charMoney2[i]-0x30);
}
}
SetDlgItemText(hDlg, PROF_MONEY1+j,charMoney1);
strcpy(fileName,men[Member[j].men].network);
filePoint=strchr(fileName,'.');
strcpy(filePoint+1,"doc");
if ((fp=fopen(fileName,"rb"))!=NULL) {
fseek(fp,0,SEEK_END);
fileSize=ftell(fp);
fseek(fp,0,SEEK_SET);
fileBuffer=malloc((int)fileSize);
do {
fread(fileBuffer,1,1,fp);
} while(fileBuffer[0]!=0x0d);
fseek(fp,1,SEEK_CUR);
for (i=0 ; i<(int)fileSize ; i++) {
fread(&fileBuffer[i],1,1,fp);
switch (fileBuffer[i]) {
case 0x0d:
fseek(fp,1,SEEK_CUR);
fileBuffer[i]=0x00;
i--;
break;
case 0x0a:
fileBuffer[i]=0x00;
i--;
break;
case 0x1a:
fileBuffer[i]=0x00;
i=420;
break;
}
}
SetDlgItemText(hDlg, PROF_PROF1+j,fileBuffer);
fclose(fp);
free(fileBuffer);
}
/* if (men[Member[j].men].mode!=0) {
dlgHdc=GetDC(hDlg);
Dfase_put_kachi(dlgHdc,Member[j].men,0,j);
ReleaseDC(hDlg,dlgHdc);
}
*/
}
break;
/* case WM_TIMER:
EndDialog(hDlg, TRUE);
break;
*/
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
}
return FALSE;
}
/* キャラクター選択ダイアログ */
BOOL FAR PASCAL _export CharDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
UINT i;
static UINT menCount;
static int drawCnt;
static int selNumber[4];
DWORD dwIndex;
char szBuf[21];
static char charName[21];
static char *cn[17];
static int rank[16];
char buffer[64];
int me;
static char charMatrix[3][21];
int cnt;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
menCount=0;
SendDlgItemMessage(hDlg, CB_CHAR,
LB_RESETCONTENT, 0, 0L);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
if (me!=(int)i) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, CB_CHAR,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
}
memcpy(charName,cn[me],20);
SendDlgItemMessage(hDlg, CB_SELCHAR,LB_ADDSTRING,0,
(LPARAM) ((LPCSTR)charName));
return FALSE;
case WM_COMMAND :
switch (wParam) {
case CB_CHAR:
if (HIWORD(lParam)==LBN_DBLCLK) { /* ダブルクリック時 */
if (menCount==3) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
memset(charMatrix[menCount],0x00,20);
strcpy(charMatrix[menCount],szBuf);
for (i=0 ; i<menCount ; i++) {
if (memcmp(charMatrix[i],charMatrix[menCount],20)==0) {
return TRUE;
}
}
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
/* ret=SendDlgItemMessage(hDlg,CB_SELCHAR,LB_GETSELITEMS,
17,(LPARAM) ((LPCSTR)selNumber)); */
Member[menCount].men = (int)rank[dwIndex];
Wload(men[dwIndex].network,menCount);
SendDlgItemMessage(hDlg,CB_SELCHAR,LB_ADDSTRING,
0,(LPARAM) ((LPCSTR)szBuf));
menCount++;
}
}
return TRUE;
case B_SELECT:
if (menCount==3) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
memset(charMatrix[menCount],0x00,20);
strcpy(charMatrix[menCount],szBuf);
for (i=0 ; i<menCount ; i++) {
if (memcmp(charMatrix[i],charMatrix[menCount],20)==0) {
return TRUE;
}
}
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
/* ret=SendDlgItemMessage(hDlg,CB_SELCHAR,LB_GETSELITEMS,
17,(LPARAM) ((LPCSTR)selNumber)); */
Member[menCount].men = (int)rank[dwIndex];
Wload(men[dwIndex].network,menCount);
SendDlgItemMessage(hDlg,CB_SELCHAR,LB_ADDSTRING,
0,(LPARAM) ((LPCSTR)szBuf));
menCount++;
} else {
sprintf(buffer, "リストボックス内の項目が選択されていません\0");
MessageBox(hDlg, buffer,
"WARNING", MB_ICONEXCLAMATION|MB_OK);
}
return TRUE;
case B_RETCHAR:
menCount=0;
EndDialog(hDlg, FALSE);
return FALSE;
case B_GOCHAR:
if (menCount==3) {
menCount=0;
EndDialog(hDlg, TRUE);
}
return TRUE;
}
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
/* 師匠選択ダイアログ */
BOOL FAR PASCAL _export MastDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
UINT i;
static UINT menCount;
static int drawCnt;
static int selNumber[4];
DWORD dwIndex;
char szBuf[21];
static char charName[21];
static char *cn[17];
static int rank[16];
char buffer[64];
int me;
int cnt;
static int mastMat[16];
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
menCount=0;
SendDlgItemMessage(hDlg, CB_CHAR,
LB_RESETCONTENT, 0, 0L);
me = MenNamePull(cn);
memset(mastMat,0x00,32);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
if (me!=(int)i) {
rank[cnt]=pick_man_list[i];
mastMat[cnt]=i;
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, CB_CHAR,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
}
mastNo=255;
return FALSE;
case WM_COMMAND :
switch (wParam) {
case CB_CHAR:
if (HIWORD(lParam)==LBN_DBLCLK) { /* ダブルクリック時 */
if (menCount==1) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
Wload(men[dwIndex].network,3);
SetDlgItemText(hDlg, MAST_NAME, szBuf);
menCount++;
mastNo=(int)(mastMat[dwIndex]+0x20);
}
}
return TRUE;
case B_SELECT:
if (menCount==1) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
Wload(men[dwIndex].network,3);
SetDlgItemText(hDlg, MAST_NAME, szBuf);
menCount++;
mastNo=(int)(dwIndex+0x20);
} else {
sprintf(buffer, "リストボックス内の項目が選択されていません\0");
MessageBox(hDlg, buffer,
"WARNING", MB_ICONEXCLAMATION|MB_OK);
}
return TRUE;
case B_RETCHAR:
menCount=0;
EndDialog(hDlg, FALSE);
return FALSE;
case B_GOCHAR:
if (menCount==1) {
menCount=0;
EndDialog(hDlg, TRUE);
}
return TRUE;
}
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
/* 観戦での相手選択ダイアログ */
BOOL FAR PASCAL _export DekuDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
UINT i;
static UINT menCount;
static int drawCnt;
static int selNumber[4];
DWORD dwIndex;
char szBuf[21];
static char charName[21];
static char *cn[17];
static int rank[16];
char buffer[64];
int me;
static char charMatrix[3][21];
int cnt;
switch (message) {
case WM_INITDIALOG :
menCount=0;
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SendDlgItemMessage(hDlg, CB_CHAR,
LB_RESETCONTENT, 0, 0L);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
if (me!=(int)i) {
if (mastNo-0x20!=(int)i) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, CB_CHAR,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
}
}
memcpy(charName,cn[me],20);
SendDlgItemMessage(hDlg, CB_SELCHAR,LB_ADDSTRING,0,
(LPARAM) ((LPCSTR)charName));
return FALSE;
case WM_COMMAND :
switch (wParam) {
case CB_CHAR:
if (HIWORD(lParam)==LBN_DBLCLK) { /* ダブルクリック時 */
if (menCount==3) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
memset(charMatrix[menCount],0x00,20);
strcpy(charMatrix[menCount],szBuf);
for (i=0 ; i<menCount ; i++) {
if (memcmp(charMatrix[i],charMatrix[menCount],20)==0) {
return TRUE;
}
}
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
/* ret=SendDlgItemMessage(hDlg,CB_SELCHAR,LB_GETSELITEMS,
17,(LPARAM) ((LPCSTR)selNumber)); */
Member[menCount].men = (int)rank[dwIndex];
Wload(men[dwIndex].network,menCount);
SendDlgItemMessage(hDlg,CB_SELCHAR,LB_ADDSTRING,
0,(LPARAM) ((LPCSTR)szBuf));
menCount++;
}
}
return TRUE;
case B_SELECT:
if (menCount==3) {
/* 全員えらんだ処理 */;
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg,
CB_CHAR, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
selectChar=rank[dwIndex];
SendDlgItemMessage(hDlg, CB_CHAR,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
memset(charMatrix[menCount],0x00,20);
strcpy(charMatrix[menCount],szBuf);
for (i=0 ; i<menCount ; i++) {
if (memcmp(charMatrix[i],charMatrix[menCount],20)==0) {
return TRUE;
}
}
if (DialogBox(hDlgInstance, "ProfDialog", hDlg, (DLGPROC)lpfnProfDlgProc)) {
break;
}
/* ret=SendDlgItemMessage(hDlg,CB_SELCHAR,LB_GETSELITEMS,
17,(LPARAM) ((LPCSTR)selNumber)); */
Member[menCount].men = (int)rank[dwIndex];
Wload(men[dwIndex].network,menCount);
SendDlgItemMessage(hDlg,CB_SELCHAR,LB_ADDSTRING,
0,(LPARAM) ((LPCSTR)szBuf));
menCount++;
} else {
sprintf(buffer, "リストボックス内の項目が選択されていません\0");
MessageBox(hDlg, buffer,
"WARNING", MB_ICONEXCLAMATION|MB_OK);
}
return TRUE;
case B_RETCHAR:
menCount=0;
EndDialog(hDlg, FALSE);
return FALSE;
case B_GOCHAR:
if (menCount==3) {
menCount=0;
EndDialog(hDlg, TRUE);
}
return TRUE;
}
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
static int fddNo;
int FileCopy(char *hddFile,char *fddFile)
{
int fh1,fh2;
long fileSize;
char *readBuf;
OFSTRUCT openBuf1,openBuf2;
if ((fh1=OpenFile(hddFile,&openBuf1,OF_SHARE_DENY_READ))==HFILE_ERROR)
return FALSE;
if ((fh2=OpenFile(fddFile,&openBuf2,OF_SHARE_DENY_WRITE|OF_CREATE))==HFILE_ERROR)
return FALSE;
fileSize=_llseek(fh1,0L,2);
readBuf=malloc((int)fileSize);
_llseek(fh1,0L,0);
_lread( fh1,readBuf,(UINT)fileSize);
_lwrite(fh2,readBuf,(UINT)fileSize);
_lclose(fh1);
_lclose(fh2);
free(readBuf);
return TRUE;
}
int InitCopy(char *hddFile,char *fddFile)
{
char fddNetName[64];
char fddDocName[64];
char *point;
int i;
HFILE fh;
OFSTRUCT openBuf;
if ((fh=OpenFile(fddFile,&openBuf,OF_SHARE_EXCLUSIVE|OF_CREATE))==HFILE_ERROR)
return FALSE;
_lclose(fh);
for (i=0 ; i<17 ; i++) {
strcpy(fddNetName,fddFile);
point=_mbsrchr(fddNetName,'\\');
strcpy((char *)(point+1),men[i].network);
if ((fh=OpenFile(fddNetName,&openBuf,OF_SHARE_EXCLUSIVE|OF_CREATE))==HFILE_ERROR)
return FALSE;
_lclose(fh);
strcpy(fddDocName,fddNetName);
point=_mbsrchr(fddDocName,'.');
strcpy((char *)(point+1),"doc");
if ((fh=OpenFile(fddDocName,&openBuf,OF_SHARE_EXCLUSIVE|OF_CREATE))==HFILE_ERROR)
return FALSE;
_lclose(fh);
}
return TRUE;
}
int OneCharSave(int charNo,char *hddFile,char *fddFile)
{
char fddNetName[64];
char hddDocName[64];
char fddDocName[64];
char oneCharBuf[40];
char *point;
HFILE fh;
OFSTRUCT openBuf;
long fileSize;
int datCount;
char datBuf[4];
if ((fh=OpenFile(fddFile,&openBuf,OF_SHARE_EXCLUSIVE|OF_READWRITE))==HFILE_ERROR)
return FALSE;
fileSize=_llseek(fh,0L,2);
if (fileSize>611) {
_lclose(fh);
return -3;
}
datCount=(int)(fileSize/36L);
sprintf(oneCharBuf,"%12s %2d %6d %9s %1d",
men[charNo].name,men[charNo].rank,men[charNo].money,
men[charNo].network,men[charNo].mode);
oneCharBuf[34]=0x0d;
oneCharBuf[35]=0x0a;
sprintf(datBuf,"%2.2d",datCount+1);
if (datBuf[0]==' ')
datBuf[0]='0';
memcpy(&oneCharBuf[26],datBuf,2);
_lwrite(fh,oneCharBuf,(UINT)36);
_lclose(fh);
strcpy(fddNetName,fddFile);
point=_mbsrchr(fddNetName,'\\');
strcpy((char *)(point+1),men[charNo].network);
point=_mbsrchr(fddNetName,'.');
memcpy((char *)(point-2),datBuf,2);
if (FileCopy(men[charNo].network,fddNetName)!=TRUE) {
SetCursor(LoadCursor(hInst,IDC_ARROW));
return FALSE;
}
strcpy(fddDocName,fddNetName);
point=_mbsrchr(fddDocName,'.');
strcpy((char *)(point+1),"doc");
strcpy(hddDocName,men[charNo].network);
point=_mbsrchr(hddDocName,'.');
strcpy((char *)(point+1),"doc");
if (FileCopy(hddDocName,fddDocName)!=TRUE) {
SetCursor(LoadCursor(hInst,IDC_ARROW));
return FALSE;
}
return TRUE;
}
static char fddCharName[17][20];
static char fddNetName[17][13];
static int fdCnt;
int FddCharSeek(char *fddFile)
{
int fh1;
long fileSize;
OFSTRUCT openBuf1;
char *readBuf;
char *point;
int i,j;
char nameBuf[16];
if ((fh1=OpenFile(fddFile,&openBuf1,OF_SHARE_DENY_READ))==HFILE_ERROR)
return FALSE;
fileSize=_llseek(fh1,0L,2);
readBuf=malloc((int)fileSize);
fdCnt=(int)(fileSize/36L);
_llseek(fh1,0L,0);
_lread( fh1,readBuf,(UINT)fileSize);
_lclose(fh1);
for (i=0 ; i<17 ; i++) {
memset(fddCharName[i],0x00,20);
memset( fddNetName[i],0x00,13);
}
for (i=0 ; i<fdCnt ; i++) {
memset(nameBuf,0x00,16);
memcpy(nameBuf,&readBuf[i*36],12);
for (j=0 ; j<12 ; j++) {
if (nameBuf[j]!=' ') {
point=(char *)&nameBuf[j];
break;
}
}
strcpy(fddCharName[i],point);
memcpy( fddNetName[i],&readBuf[i*36+23],9);
}
free(readBuf);
return TRUE;
}
int OneCharLoad(DWORD hddSel,DWORD fddSel,char *hddName)
{
int fh1;
long fileSize;
OFSTRUCT openBuf1;
char hddNet[16];
char fddDoc[16];
char hddDoc[16];
char fddBuf[72];
char *readBuf1;
char *point;
if ((fh1=OpenFile(hddName,&openBuf1,OF_SHARE_EXCLUSIVE|OF_READWRITE))==HFILE_ERROR)
return FALSE;
fileSize=_llseek(fh1,0L,2);
readBuf1=malloc((int)fileSize);
if (readBuf1==NULL) {
_lclose(fh1);
return FALSE;
}
_llseek(fh1,0L,0);
_lread( fh1,readBuf1,(UINT)fileSize);
memcpy(&readBuf1[4+36*hddSel],fddCharName[fddSel],strlen(fddCharName[fddSel]));
memset(&readBuf1[4+36*hddSel+strlen(fddCharName[fddSel])],' ',12-strlen(fddCharName[fddSel]));
memcpy(&readBuf1[4+36*hddSel+18],"1000",4);
_llseek(fh1,0L,0);
_lwrite(fh1,readBuf1,(UINT)fileSize);
_lclose(fh1);
sprintf(hddNet,"usr%2.2d.net",hddSel+1);
sprintf(fddBuf,"%c:\\%s",'a'+fddNo,fddNetName[fddSel]);
if (FileCopy(fddBuf,hddNet)!=TRUE) {
free(readBuf1);
return FALSE;
}
strcpy(fddDoc,fddBuf);
strcpy(hddDoc,hddNet);
point=_mbschr(hddDoc,'.');
strcpy((char *)(point+1),"doc");
point=_mbschr(fddDoc,'.');
strcpy((char *)(point+1),"doc");
if (FileCopy(fddDoc,hddDoc)!=TRUE) {
free(readBuf1);
return FALSE;
}
free(readBuf1);
load_all_man(1);
}
BOOL FAR PASCAL _export UtilDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
static int modeFlag;
int me;
char charName[32];
char *cn[17];
static int rank[17];
int cnt;
int i/*,j*/;
DWORD dwIndex;
DWORD dwFdIndex;
static char fddFileName[128];
static OFSTRUCT openBuf1,openBuf2;
static HFILE fh1,fh2;
static int transCount;
static int selectMatrix[17];
int flag,ret;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
modeFlag=0;
transCount=0;
memset(selectMatrix,0x00,34);
PostMessage(hDlg, WM_USER+105, 0, 0L);
return FALSE;
case WM_USER+105:
/* フロッピー入れてねメッセージ */
fddNo=256;
DialogBox(hDlgInstance, "FddSelect", hDlg, (DLGPROC)lpfnFddsDlgProc);
if (fddNo!=255) {
if (GetDriveType(fddNo)!=DRIVE_REMOVABLE) {
MessageBox(hDlg, "このドライブはフロッピーディスクドライブではありません","WARNING", MB_ICONQUESTION|MB_OK);
return TRUE;
}
fddFileName[0]=(char)fddNo+'A';
fddFileName[1]=':';
fddFileName[2]='\\';
fddFileName[3]='\0';
strcat(fddFileName,"mansv.dat");
/* FDD内データの確認 */
if ((fh2=OpenFile(fddFileName,&openBuf2,OF_EXIST))==HFILE_ERROR) {
if (MessageBox(hDlg, "データファイルが存在しません。作成してよろしいですか?","FDD", MB_ICONEXCLAMATION|MB_OKCANCEL)==IDCANCEL)
return TRUE;
if (InitCopy("mansv.dat",fddFileName)!=TRUE) {
MessageBox(hDlg,"データファイルが開けません。中断します","FDD",MB_ICONEXCLAMATION|MB_OK);
EndDialog(hDlg, TRUE);
return TRUE;
}
}
/* FDD内データの表示 */
if (FddCharSeek(fddFileName)!=TRUE) {
MessageBox(hDlg, "データファイルが存在しません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
EndDialog(hDlg, TRUE);
modeFlag=0;
return TRUE;
}
for (i=0;i<fdCnt ; i++) {
memcpy(charName,fddCharName[i],20);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
}
/* HDD内全データの検索表示 */
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
break;
case WM_COMMAND :
switch (wParam) {
case IDC_INIT:
/* ==まずはデータ初期化から== */
if (MessageBox(hDlg, "本当によろしいですか?","データ初期化", MB_ICONEXCLAMATION|MB_OKCANCEL)==IDCANCEL)
return TRUE;
if (init_member_data(1)==2) {
MessageBox(hDlg, "勝ち抜き戦が終了していませんので初期化できません","データ初期化", MB_ICONEXCLAMATION|MB_OK);
return TRUE;
}
break;
case IDC_TOFD:
/* ==次にFDDにデータ退避== */
if (fddNo==255) {
MessageBox(hDlg, "FDDのドライブが選択されていません","FD", MB_ICONEXCLAMATION|MB_OK);
break;
}
dwIndex = SendDlgItemMessage(hDlg,HDD_LB, LB_GETCURSEL, 0, 0);
if (dwIndex==LB_ERR) {
MessageBox(hDlg, "キャラクターが選択されていません","選択", MB_ICONEXCLAMATION|MB_OK);
break;
}
if ((ret=OneCharSave(rank[dwIndex],"mansv.dat",fddFileName))!=TRUE) {
if (ret==-3)
MessageBox(hDlg, "データがいっぱいです。別のフロッピーを使用して下さい","WARNING", MB_ICONEXCLAMATION|MB_OK);
else
MessageBox(hDlg, "データファイルが開けません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
transCount=0;
EndDialog(hDlg, TRUE);
return TRUE;
}
SendDlgItemMessage(hDlg, HDD_LB,
LB_GETTEXT, (WPARAM)dwIndex, (LPARAM) ((LPCSTR)charName));
SendDlgItemMessage(hDlg, FDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
selectMatrix[transCount]=rank[dwIndex];
transCount++;
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
flag=0;
SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
for (i=0;i<17 ; i++) {
/* for (j=0 ; j<transCount ; j++)
if (selectMatrix[j]==pick_man_list[i]) {
flag=1;
break;
}
if (flag!=0) {
flag=0;
continue;
} */
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
break;
case IDC_TOHD:
/* ==トドメはFDDから吸い上げ== */
if (fddNo==255) {
MessageBox(hDlg, "FDDのドライブが選択されていません","FD", MB_ICONEXCLAMATION|MB_OK);
break;
}
/* FDD内データの検索 */
if (FddCharSeek(fddFileName)!=TRUE) {
MessageBox(hDlg, "データファイルが存在しません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
EndDialog(hDlg, TRUE);
modeFlag=0;
return TRUE;
}
for (i=0;i<fdCnt ; i++) {
memcpy(charName,fddCharName[i],20);
}
dwIndex =SendDlgItemMessage(hDlg,HDD_LB, LB_GETCURSEL, 0, 0);
dwFdIndex=SendDlgItemMessage(hDlg,FDD_LB, LB_GETCURSEL, 0, 0);
if (dwFdIndex==LB_ERR) {
MessageBox(hDlg, "転送するFDD側キャラクターが選択されていません","選択", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (dwIndex==LB_ERR) {
MessageBox(hDlg, "HDDの受け側キャラクターが選択されていません","選択", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (OneCharLoad(rank[dwIndex],dwFdIndex,"man.dat")!=TRUE) {
MessageBox(hDlg, "データファイルが開けません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
EndDialog(hDlg, TRUE);
return TRUE;
}
SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
break;
case IDC_FDSEL:
fddNo=256;
DialogBox(hDlgInstance, "FddSelect", hDlg, (DLGPROC)lpfnFddsDlgProc);
if (fddNo!=255) {
if (GetDriveType(fddNo)!=DRIVE_REMOVABLE) {
MessageBox(hDlg, "このドライブはフロッピーディスクドライブではありません","WARNING", MB_ICONQUESTION|MB_OK);
EndDialog(hDlg, TRUE);
return TRUE;
}
fddFileName[0]=(char)fddNo+'A';
fddFileName[1]=':';
fddFileName[2]='\\';
fddFileName[3]='\0';
strcat(fddFileName,"mansv.dat");
/* FDD内データの確認 */
if ((fh2=OpenFile(fddFileName,&openBuf2,OF_EXIST))==HFILE_ERROR) {
if (MessageBox(hDlg, "データファイルが存在しません。作成してよろしいですか?","FDD", MB_ICONEXCLAMATION|MB_OKCANCEL)==IDCANCEL)
return TRUE;
if (InitCopy("mansv.dat",fddFileName)!=TRUE) {
MessageBox(hDlg,"データファイルが開けません。中断します","FDD",MB_ICONEXCLAMATION|MB_OK);
EndDialog(hDlg, TRUE);
return TRUE;
}
}
/* FDD内データの表示 */
if (FddCharSeek(fddFileName)!=TRUE) {
MessageBox(hDlg, "データファイルが存在しません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
modeFlag=0;
EndDialog(hDlg, TRUE);
return TRUE;
}
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
for (i=0;i<fdCnt ; i++) {
memcpy(charName,fddCharName[i],20);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
/* HDD内全データの検索表示 */
SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
}
break;
/* case TRANS_B:
if (modeFlag==0)
return TRUE;
if (modeFlag==1) {
if (OneCharSave(rank[dwIndex],"man.dat",fddFileName)!=TRUE) {
MessageBox(hDlg, "データファイルが開けません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
SetDlgItemText(hDlg, INFO_MESSAGE,info[0]);
SetDlgItemText(hDlg, ARROW_M,arrowData[0]);
transCount=0;
return TRUE;
}
SendDlgItemMessage(hDlg, HDD_LB,
LB_GETTEXT, (WPARAM)dwIndex, (LPARAM) ((LPCSTR)charName));
SendDlgItemMessage(hDlg, FDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
selectMatrix[transCount]=rank[dwIndex];
transCount++;
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
flag=0;
SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
for (i=0;i<17 ; i++) {
for (j=0 ; j<transCount ; j++)
if (selectMatrix[j]==pick_man_list[i]) {
flag=1;
break;
}
if (flag!=0) {
flag=0;
continue;
}
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
if (MessageBox(hDlg, "データ転送を終了します。よろしいですか?","メッセージ", MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
SetDlgItemText(hDlg, INFO_MESSAGE,info[0]);
SetDlgItemText(hDlg, ARROW_M,arrowData[0]);
transCount=0;
return TRUE;
}
return TRUE;
}
if (modeFlag==2) {
if (OneCharLoad(rank[dwIndex],dwFdIndex,"man.dat")!=TRUE) {
MessageBox(hDlg, "データファイルが開けません。中断します","FDD", MB_ICONEXCLAMATION|MB_OK);
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
SetDlgItemText(hDlg, INFO_MESSAGE,info[0]);
SetDlgItemText(hDlg, ARROW_M,arrowData[0]);
return TRUE;
}
SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
if (MessageBox(hDlg, "データ転送を終了します。よろしいですか?","メッセージ", MB_ICONQUESTION|MB_OKCANCEL)==IDOK) {
modeFlag=0;
dwIndex = SendDlgItemMessage(hDlg, HDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
dwIndex = SendDlgItemMessage(hDlg, FDD_LB,
LB_RESETCONTENT, (WPARAM)0 , (LPARAM)0L);
SetDlgItemText(hDlg, INFO_MESSAGE,info[0]);
SetDlgItemText(hDlg, ARROW_M,arrowData[0]);
transCount=0;
return TRUE;
}
return TRUE;
}
return TRUE;
*/
case IDC_END:
EndDialog(hDlg, TRUE);
return TRUE;
}
break;
}
return FALSE;
}
#define HAIMAX (9*4*3+7*4)
BOOL FAR PASCAL _export EnviDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
extern int Haipoint;
int a;
char st[20];
char *tozennum();
lParam++;
lParam--;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
if (Open_mode==FALSE)
CheckDlgButton(hDlg,OPEN_M,0);
else
CheckDlgButton(hDlg,OPEN_M,1);
if (Teach_mode==FALSE)
CheckDlgButton(hDlg,AUTO_M,0);
else
CheckDlgButton(hDlg,AUTO_M,1);
if (eFlag.proc==CC_KACHI&&eFlag.proc==CC_KAKE)
CheckDlgButton(hDlg,OPEN_M,2);
if (eFlag.proc==CC_SHINAN)
CheckDlgButton(hDlg,AUTO_M,2);
a = HAIMAX-Haipoint-14;
strcpy(st,tozennum(a));
SetDlgItemText(hDlg, NOKORI,st);
switch(gSpeed) {
case 100:
CheckRadioButton(hDlg,IDC_FAST,IDC_SLOW,IDC_FAST);
break;
case 200:
CheckRadioButton(hDlg,IDC_FAST,IDC_SLOW,IDC_NORMAL);
break;
case 500:
CheckRadioButton(hDlg,IDC_FAST,IDC_SLOW,IDC_SLOW);
break;
}
return FALSE;
case WM_COMMAND :
switch (wParam) {
case OPEN_M:
if (eFlag.proc!=CC_KACHI&&eFlag.proc!=CC_KAKE)
open_tehai();
return TRUE;
case AUTO_M:
if (eFlag.proc!=CC_SHINAN)
Teach_mode ^= 1;
return TRUE;
case MOCHITEN_B:
DialogBox(hDlgInstance, "ScoreWindow", hWnd, (DLGPROC)lpfnEScrDlgProc);
return TRUE;
case G_ESC:
EndDialog(hDlg, TRUE);
return TRUE;
case G_END:
EndDialog(hDlg, FALSE);
return TRUE;
case IDC_FAST:
gSpeed=100;
return TRUE;
case IDC_NORMAL:
gSpeed=200;
return TRUE;
case IDC_SLOW:
gSpeed=500;
return TRUE;
}
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
BOOL FAR PASCAL _export Ha99DlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
RECT rect,rectP;
int baseX,baseY;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
/* SetTimer(hDlg,ID_DISPTIME,4000,lpfnDispDlgProc); */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
break;
case WM_COMMAND :
switch (wParam) {
case NONAGA_99:
dir99=FALSE;
EndDialog(hDlg, TRUE);
return TRUE;
case NAGASI_99:
dir99=TRUE;
EndDialog(hDlg, TRUE);
return TRUE;
}
break;
/* case WM_TIMER:
EndDialog(hDlg, TRUE);
return TRUE; */
case WM_PAINT :
BeginPaint(hDlg, &ps);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
BOOL FAR PASCAL _export DispDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
HDC hdc;
RECT rect;
RECT rectP;
int baseX,baseY;
int ret;
HWND hd;
switch (message) {
case WM_INITDIALOG :
SetTimer(hDlg,ID_DISPTIME,4000,lpfnDispDlgProc);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
ret=(int)SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
hd=SetCapture(hDlg);
break;
case WM_TIMER:
EndDialog(hDlg, TRUE);
return TRUE;
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return TRUE;
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
case WM_PAINT :
hdc=BeginPaint(hDlg, &ps);
SetDlgItemText(hDlg, K_MES, kyokuMessage);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
/*ここからだよん6/1*/
BOOL FAR PASCAL _export ScorDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
RECT rect,rectP;
int i;
static int scrFlag;
static int flag[4];
static int all = FALSE;
int baseX,baseY;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
scrFlag=0;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY-64, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_TIMER:
switch(scrFlag) {
case 0:
scrFlag++;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
PostMessage(hDlg, WM_PAINT, 0 ,0L);
break;
case 1:
scrFlag++;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
break;
case 2:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return TRUE;
}
break;
case WM_LBUTTONUP:
switch(scrFlag) {
case 0:
scrFlag++;
PostMessage(hDlg, WM_PAINT, 0 ,0L);
break;
case 1:
scrFlag++;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
break;
case 2:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return TRUE;
}
break;
case WM_NCLBUTTONUP:
switch(scrFlag) {
case 0:
scrFlag++;
PostMessage(hDlg, WM_PAINT, 0 ,0L);
return 0;
case 1:
scrFlag++;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
return 0;
case 2:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
}
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
if (scrFlag==0) {
for ( i = 0; i < 4; i++ ) {
flag[i] = FALSE;
if ( Member[i].delta != 0 ) {
flag[i] = TRUE;
all = TRUE;
display_eachscore(i,Member[i].score,Member[i].delta,men[Member[i].men].name);
Member[i].score += Member[i].delta;
} else {
display_eachscr(i,Member[i].score,Member[i].delta,men[Member[i].men].name);
}
}
for (i=0 ; i<4 ; i++) {
SetDlgItemText(hDlg, P_NAME1+i, scoreName[i]);
SetDlgItemText(hDlg, PN_SCR1+i, scoreSt1[i]);
SetDlgItemText(hDlg, SCR_PM1+i, scoreSt2[i]);
}
} else if (scrFlag == 1) {
while ( all ) {
all = FALSE;
for ( i = 0; i < 4; i++ ) {
if ( flag[i] ) {
flag[i] = (down_eachscore(i) != 0 ? TRUE : FALSE);
}
all |= flag[i];
SetDlgItemText(hDlg, P_NAME1+i, scoreName[i]);
SetDlgItemText(hDlg, PN_SCR1+i, scoreSt1[i]);
SetDlgItemText(hDlg, SCR_PM1+i, scoreSt2[i]);
}
}
for ( i = 0; i < 4; i++ ) {
if ( Member[i].delta == 0 ) {
display_eachscore(i,Member[i].score,0,men[Member[i].men].name);
}
}
}
EndPaint(hDlg, &ps);
break;
case WM_MOVE:
for (i=0 ; i<4 ; i++) {
Member[i].tehai.top = haisort(Member[i].tehai.top);
put_alltehai(i); /* graphics */
}
display_dora();
display_udora();
disp_naki();
display_sai();
display_bahyoji();
display_hyochar(Siba,reaStick);
display_stehai();
Display_reach_b();
break;
}
return FALSE;
}
BOOL FAR PASCAL _export EScrDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
RECT rect,rectP;
int i;
static int scrFlag;
static int flag[4];
static int all = FALSE;
int baseX,baseY;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
scrFlag=0;
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_PAINT :
BeginPaint(hDlg, &ps);
for ( i = 0; i < 4; i++ ) {
flag[i] = FALSE;
/* if ( Member[i].delta != 0 ) {
flag[i] = TRUE;
all = TRUE;
display_eachscore(i,Member[i].score,Member[i].delta,men[Member[i].men].name);
Member[i].score += Member[i].delta;
} else { */
display_eachscr(i,Member[i].score,Member[i].delta,men[Member[i].men].name);
/* } */
}
for (i=0 ; i<4 ; i++) {
SetDlgItemText(hDlg, P_NAME1+i, scoreName[i]);
SetDlgItemText(hDlg, PN_SCR1+i, scoreSt1[i]);
}
EndPaint(hDlg, &ps);
break;
case WM_MOVE:
/* for (i=0 ; i<4 ; i++) {
put_alltehai(i);
}
display_dora();
disp_naki();
display_sai();
display_bahyoji();
display_hyochar(Siba,reaStick);
display_stehai(); */
break;
}
return FALSE;
}
BOOL FAR PASCAL _export YakuDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
PAINTSTRUCT ps;
int i;
int baseX,baseY;
RECT rect,rectP;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_TIMER:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
case WM_PAINT :
BeginPaint(hDlg, &ps);
for (i=0 ; i<10 ; i++) {
SetDlgItemText(hDlg, YAKU_1+i*2,yakuMatrix.word[i].yaku);
SetDlgItemText(hDlg, HAN_1+i*2,yakuMatrix.word[i].han);
}
SetDlgItemText(hDlg, TOTAL,yakuMatrix.total);
SetDlgItemText(hDlg,FU_HAN,yakuMatrix.fuHan);
SetDlgItemText(hDlg, TEN,yakuMatrix.ten);
EndPaint(hDlg, &ps);
break;
}
return FALSE;
}
BOOL FAR PASCAL _export RyukDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
int baseX,baseY;
RECT rect,rectP;
switch (message) {
case WM_INITDIALOG :
SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc);
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_TIMER:
ReleaseCapture();
EndDialog(hDlg, TRUE);
break;
case WM_LBUTTONUP:
ReleaseCapture();
EndDialog(hDlg, TRUE);
break;
case WM_NCLBUTTONUP:
ReleaseCapture();
EndDialog(hDlg, TRUE);
return 0;
}
return FALSE;
}
BOOL FAR PASCAL _export MesdDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
int baseX,baseY;
RECT rect,rectP;
switch (message) {
case WM_INITDIALOG :
/* SetTimer(hDlg,ID_DISPTIME,4000,lpfnScorDlgProc); */
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
SetDlgItemText(hDlg, MES_DISP,dispMessage);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
/* case WM_TIMER:
EndDialog(hDlg, TRUE);
break;*/
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
}
return FALSE;
}
BOOL FAR PASCAL _export TotaDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
int i,j;
char score[16],scrJms[16],buf[3];
int baseX,baseY;
RECT rect,rectP;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SetDlgItemText(hDlg, MES_DISP,dispMessage);
GetWindowRect(hDlg,&rect);
GetWindowRect(hWnd,&rectP);
baseX=((rectP.right-rectP.left)-(rect.right-rect.left))/2+rectP.left;
baseY=((rectP.bottom-rectP.top)-(rect.bottom-rect.top))/2+rectP.top;
SetWindowPos(hDlg, (HWND)NULL, baseX, baseY, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
PostMessage(hDlg, WM_USER+105, 0, 0L);
break;
case WM_USER+105:
SetCapture(hDlg);
break;
case WM_NCLBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
return 0;
case WM_LBUTTONUP:
EndDialog(hDlg, TRUE);
ReleaseCapture();
break;
case WM_PAINT :
for ( i = 0; i < 4; i++ ) {
SetDlgItemText(hDlg, TT_NAME1+i,men[Member[i].men].name);
itoa(last_sc[i],score,10);
if (score[0]=='-') {
strcpy(scrJms,"-");
j=1;
} else {
strcpy(scrJms,"+");
j=0;
}
for ( ; j<(int)strlen(score) ; j++) {
strcpy(buf,"0");
buf[1]+=score[j]-0x30;
buf[2]=0x00;
strcat(scrJms,buf);
}
SetDlgItemText(hDlg, TT_SCR1+i ,scrJms);
}
break;
case WM_MOVE:
for (i=0 ; i<4 ; i++) {
Member[i].tehai.top = haisort(Member[i].tehai.top);
put_alltehai(i); /* graphics */
}
display_dora();
display_udora();
disp_naki();
display_sai();
display_bahyoji();
display_hyochar(Siba,reaStick);
display_stehai();
Display_reach_b();
break;
}
return FALSE;
}
BOOL FAR PASCAL _export ProfDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
int i;
char charName[32];
char charMoney1[32];
char charMoney2[32];
char fileName[20];
char *filePoint;
static char *fileBuffer;
static FILE *fp;
PAINTSTRUCT ps;
HPALETTE fase;
/*DRAWITEMSTRUCT far *drs;*/
long fileSize;
HDC dlgHdc;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
memset(charName,0x00,13);
memset(charMoney1,0x00,32);
memset(charMoney2,0x00,32);
/* SendMessage(hDlg, WM_PAINT, 0 ,0L); */
break;
case WM_COMMAND :
switch (wParam) {
case PROF_OK:
dlgHdc = BeginPaint (hDlg, &ps) ;
DeleteObject(fase);
RecoverPalette(dlgHdc);
EndDialog(hDlg, FALSE);
EndPaint (hDlg, &ps) ;
break;
case PROF_NG:
dlgHdc = BeginPaint (hDlg, &ps) ;
DeleteObject(fase);
RecoverPalette(dlgHdc);
EndDialog(hDlg, TRUE);
EndPaint (hDlg, &ps) ;
break;
}
break;
case WM_PAINT:
dlgHdc = BeginPaint (hDlg, &ps) ;
strcpy(charName,men[selectChar].name);
SetDlgItemText(hDlg, PROF_NAME,charName);
itoa(men[selectChar].money,charMoney2,10);
if (men[selectChar].money<0) {
strcpy(charMoney1,"-");
for (i=0 ; i<(int)(6-strlen(charMoney2)-1) ; i++)
strcat(charMoney1," ");
for (i=0 ; i<(int)strlen(charMoney2)-1 ; i++) {
strcat(charMoney1,"0");
charMoney1[strlen(charMoney1)-1]+=(char)(charMoney2[i+1]-0x30);
}
} else {
strcpy(charMoney1," ");
for (i=0 ; i<(int)(6-strlen(charMoney2)) ; i++)
strcat(charMoney1," ");
for (i=0 ; i<(int)strlen(charMoney2) ; i++) {
strcat(charMoney1,"0");
charMoney1[strlen(charMoney1)-1]+=(char)(charMoney2[i]-0x30);
}
}
SetDlgItemText(hDlg, PROF_MONEY,charMoney1);
strcpy(fileName,men[selectChar].network);
filePoint=strchr(fileName,'.');
strcpy(filePoint+1,"doc");
if ((fp=fopen(fileName,"rb"))!=NULL) {
fseek(fp,0,SEEK_END);
fileSize=ftell(fp);
fseek(fp,0,SEEK_SET);
fileBuffer=malloc((int)fileSize);
do {
fread(fileBuffer,1,1,fp);
} while(fileBuffer[0]!=0x0d);
fseek(fp,1,SEEK_CUR);
for (i=0 ; i<(int)fileSize ; i++) {
fread(&fileBuffer[i],1,1,fp);
switch (fileBuffer[i]) {
case 0x0d:
fseek(fp,1,SEEK_CUR);
fileBuffer[i]=0x00;
i--;
break;
case 0x0a:
fileBuffer[i]=0x00;
i--;
break;
case 0x1a:
fileBuffer[i]=0x00;
i=420;
break;
}
}
SetDlgItemText(hDlg, PROF_PROF,fileBuffer);
fclose(fp);
free(fileBuffer);
}
/* if (men[selectChar].mode!=0) {
fase=Dfase_put_prof(dlgHdc,selectChar,0);
}
*/
EndPaint (hDlg, &ps) ;
break;
/* case WM_DRAWITEM:
drs=(DRAWITEMSTRUCT far *)lParam;
if (men[selectChar].mode!=0) {
Dfase_put_prof(drs->hDC,selectChar,0);
}
*/ }
return FALSE;
}
BOOL FAR PASCAL _export ChgpDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
static int rank[17];
static char *cn[17];
static char charName[21];
char szBuf[64];
static int setNo;
int me;
int cnt;
int i;
DWORD dwIndex;
switch (message) {
case WM_INITDIALOG :
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SetDlgItemText(hDlg, CP_NOW_PLAYER_M,men[Member[3].men].name);
me = MenNamePull(cn);
charName[20]=0x00;
cnt=0;
for (i=0;i<17 ; i++) {
rank[cnt]=pick_man_list[i];
cnt++;
memcpy(charName,cn[i],20);
dwIndex = SendDlgItemMessage(hDlg, CP_ALL_CHAR_LB,
LB_ADDSTRING, 0, (LPARAM) ((LPCSTR)charName));
}
setNo=255;
break;
case WM_COMMAND :
switch (wParam) {
case CP_ALL_CHAR_LB:
if (HIWORD(lParam)==LBN_DBLCLK) { /* ダブルクリック時 */
dwIndex = SendDlgItemMessage(hDlg,CP_ALL_CHAR_LB, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
SendDlgItemMessage(hDlg, CP_ALL_CHAR_LB,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
SetDlgItemText(hDlg, CP_AFT_PLAYER_M,szBuf);
setNo=(int)dwIndex;
}
}
break;
case CP_SELECT_B:
dwIndex = SendDlgItemMessage(hDlg,CP_ALL_CHAR_LB, LB_GETCURSEL, 0, 0);
if (dwIndex != LB_ERR) {
SendDlgItemMessage(hDlg, CP_ALL_CHAR_LB,LB_GETTEXT,
(WPARAM) dwIndex, (LPARAM) ((LPCSTR) szBuf));
SetDlgItemText(hDlg, CP_AFT_PLAYER_M,szBuf);
setNo=(int)dwIndex;
}
break;
case CP_EXEC_B:
if(setNo==255)
break;
if (men[rank[setNo]].mode==0) {
Member[3].men = rank[setNo];
init_para(3); /* init_network(3); */
init_man(Member[3].men);
save_all_man();
EndDialog(hDlg, TRUE);
} else if (men[rank[setNo]].mode!=0) {
MessageBox(hDlg, "そのキャラクターには変更できません","交代", MB_ICONEXCLAMATION|MB_OK);
}
break;
case CP_CANSEL_B:
EndDialog(hDlg, TRUE);
break;
}
}
return FALSE;
}
BOOL FAR PASCAL _export ChgnDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
static char playerName[32];
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SetDlgItemText(hDlg, CN_NOW_PLAYER_M,men[Member[3].men].name);
memset(playerName,0x00,32);
break;
case WM_COMMAND :
switch (wParam) {
case CN_EXEC_B:
GetDlgItemText(hDlg, CN_CHG_NAME_ET ,(LPSTR)playerName, 32);
if (strlen(playerName)>12) {
MessageBox(hDlg, "名前が長すぎます","変更", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (strchr(playerName,' ')!=NULL) {
MessageBox(hDlg, "名前の間にスペースは入れないでください","変更", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (playerName[0]!='\0'&&playerName[0]!=' ') {
strcpy(men[Member[3].men].name,playerName);
init_para(3); /* init_network(3); */
init_man(Member[3].men);
save_all_man();
}
EndDialog(hDlg, TRUE);
break;
case CN_CANSEL_B:
EndDialog(hDlg, TRUE);
break;
}
}
return FALSE;
}
BOOL FAR PASCAL _export ChrEDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
char msg[64];
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
memset(msg,0x00,64);
break;
case WM_COMMAND :
switch (wParam) {
case IDOK:
GetDlgItemText(hDlg, IDC_EDIT1 ,(LPSTR)msg, 32);
if (strlen(msg)>12) {
MessageBox(hDlg, "名前が長すぎます","登録", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (strchr(msg,' ')!=NULL) {
MessageBox(hDlg, "名前の間にスペースは入れないでください","登録", MB_ICONEXCLAMATION|MB_OK);
break;
}
if (msg[0]!='\0'&&msg[0]!=' ') {
strcpy(men[Member[3].men].name,msg);
save_all_man();
}
EndDialog(hDlg, TRUE);
break;
case IDCANCEL:
EndDialog(hDlg, TRUE);
break;
}
}
return FALSE;
}
BOOL FAR PASCAL _export FddsDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
char driveName[64];
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SetDlgItemText(hDlg ,FD_IN ,"A:");
PostMessage(hDlg, WM_PAINT, 0 ,0L);
break;
case WM_COMMAND :
switch (wParam) {
case FD_OK:
GetDlgItemText(hDlg, FD_IN ,(LPSTR)driveName, 32);
if (driveName[0]=='\0'&&driveName[0]==' ')
break;
if (driveName[0]>='a'&&driveName[0]<='z') {
fddNo=(int)(driveName[0]-'a');
EndDialog(hDlg, TRUE);
break;
}
if (driveName[0]>='A'&&driveName[0]<='Z') {
fddNo=(int)(driveName[0]-'A');
EndDialog(hDlg, TRUE);
break;
}
MessageBox(hDlg, "不正なドライブ名です","WARNING", MB_ICONEXCLAMATION|MB_OK);
break;
case FD_NG:
EndDialog(hDlg, FALSE);
fddNo=255;
return FALSE;
}
break;
}
return FALSE;
}
int EditListData(char *nameDat,char *rankDat,char *monDat,int cnt)
{
int fh1;
long fileSize;
OFSTRUCT openBuf1;
char *readBuf;
char *point;
int i,j;
char nameBuf[16];
char rank_c[3];
char money_c[7];
int rank;
if ((fh1=OpenFile("man.dat",&openBuf1,OF_SHARE_DENY_READ))==HFILE_ERROR)
return FALSE;
fileSize=_llseek(fh1,0L,2);
readBuf=malloc((int)fileSize);
fdCnt=(int)(fileSize/36L);
_llseek(fh1,0L,0);
_lread( fh1,readBuf,(UINT)fileSize);
_lclose(fh1);
memset(nameBuf,0x00,16);
memset(rank_c,0x00,3);
memset(money_c,0x00,7);
memcpy(nameBuf,&readBuf[4+36*cnt],12);
memcpy(rank_c,&readBuf[4+36*cnt+13],2);
memcpy(money_c,&readBuf[4+36*cnt+16],6);
rank=atoi(rank_c);
for (j=0 ; j<12 ; j++) {
if (nameBuf[j]!=' ') {
point=(char *)&nameBuf[j];
break;
}
}
i=strlen(point);
if (rank==0) {
strcpy(nameDat,point);
strcpy(rankDat,"名人");
strcpy(monDat ,money_c);
} else {
strcpy(nameDat ,point);
sprintf(rankDat,"第%2d位",rank);
strcpy(monDat ,money_c);
/* memcpy( line ,point,i);
memcpy(&line[15],"第",2);
memcpy(&line[17],rank_c,2);
memcpy(&line[19],"位",2);
memcpy(&line[24],money_c,6);
*/
}
free(readBuf);
return TRUE;
}
BOOL FAR PASCAL _export MemiDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
char name[16];
char rank[8];
char money[8];
int i;
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
SendDlgItemMessage(hDlg, MEM_INFO__LIST1,
LB_RESETCONTENT, 0, 0L);
PostMessage(hDlg, WM_USER+106, 0 ,0L);
return TRUE;
case WM_USER+106 :
for (i=0 ; i<17 ; i++) {
memset(name, 0x00,16);
memset(rank, 0x00,8);
memset(money,0x00,8);
if (EditListData(name,rank,money,i)!=FALSE) {
SetDlgItemText(hDlg, IDC_NAME1+i*3,name);
SetDlgItemText(hDlg, IDC_RANK1+i*3,rank);
SetDlgItemText(hDlg,IDC_MONEY1+i*3,money);
}
}
return TRUE;
case WM_COMMAND :
switch (wParam) {
case MEM_INFO_OK:
EndDialog(hDlg, TRUE);
return FALSE;
}
}
return FALSE;
}
BOOL FAR PASCAL _export AbouDlgProc(HWND hDlg, UINT message, UINT wParam, LONG lParam)
{
switch (message) {
case WM_INITDIALOG :
/* カーソルの変更 */
SetCursor(winCursor[1]);
ShowCursor(TRUE);
return TRUE;
case WM_COMMAND :
switch (wParam) {
case IDC_OK:
EndDialog(hDlg, TRUE);
return FALSE;
}
}
return FALSE;
}